Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/soutaro/steep.git
revision: daa249e47ff4d1d197d3b6d2d73400db32293250
revision: 8521be6192b88d5c58514783d7f58585c5545497
specs:
steep (2.0.0.dev)
activesupport (>= 5.1)
Expand Down Expand Up @@ -75,11 +75,12 @@ GEM
i18n (1.14.8)
concurrent-ruby (~> 1.0)
io-console (0.8.2)
irb (1.16.0)
irb (1.17.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.18.0)
json (2.18.1)
json-schema (6.1.0)
addressable (~> 2.8)
bigdecimal (>= 3.1, < 5)
Expand Down Expand Up @@ -126,7 +127,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (7.1.0)
rdoc (7.2.0)
erb
psych (>= 4.0.0)
tsort
Expand Down Expand Up @@ -160,7 +161,7 @@ GEM
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-on-rbs (1.9.0)
rubocop-on-rbs (1.9.1)
lint_roller (~> 1.1)
rbs (~> 3.5)
rubocop (>= 1.72.1, < 2.0)
Expand Down
404 changes: 217 additions & 187 deletions core/array.rbs

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions core/basic_object.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# * Do not have namespace "pollution" from the many methods provided in class
# Object and its included module Kernel.
# * Do not have definitions of common classes, and so references to such
# common classes must be fully qualified (`::String`, not `String`).
# common classes must be fully qualified (<code>::String</code>, not
# `String`).
#
# A variety of strategies can be used to provide useful portions of the Standard
# Library in subclasses of `BasicObject`:
Expand Down Expand Up @@ -92,8 +93,8 @@ class BasicObject
# classes to provide class-specific meaning.
#
# Unlike #==, the #equal? method should never be overridden by subclasses as it
# is used to determine object identity (that is, `a.equal?(b)` if and only if
# `a` is the same object as `b`):
# is used to determine object identity (that is, <code>a.equal?(b)</code> if and
# only if `a` is the same object as `b`):
#
# obj = "a"
# other = obj.dup
Expand Down Expand Up @@ -174,8 +175,8 @@ class BasicObject
# classes to provide class-specific meaning.
#
# Unlike #==, the #equal? method should never be overridden by subclasses as it
# is used to determine object identity (that is, `a.equal?(b)` if and only if
# `a` is the same object as `b`):
# is used to determine object identity (that is, <code>a.equal?(b)</code> if and
# only if `a` is the same object as `b`):
#
# obj = "a"
# other = obj.dup
Expand Down Expand Up @@ -315,7 +316,7 @@ class BasicObject
# def Chatty.three() end
# end
#
# *produces:*
# <em>produces:</em>
#
# Adding singleton_method_added
# Adding one
Expand Down Expand Up @@ -343,7 +344,7 @@ class BasicObject
# end
# end
#
# *produces:*
# <em>produces:</em>
#
# Removing three
# Removing one
Expand All @@ -367,7 +368,7 @@ class BasicObject
# end
# end
#
# *produces:*
# <em>produces:</em>
#
# Undefining one
#
Expand Down
11 changes: 6 additions & 5 deletions core/class.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
# When a new class is created, an object of type Class is initialized and
# assigned to a global constant (Name in this case).
#
# When `Name.new` is called to create a new object, the #new method in Class is
# run by default. This can be demonstrated by overriding #new in Class:
# When <code>Name.new</code> is called to create a new object, the #new method
# in Class is run by default. This can be demonstrated by overriding #new in
# Class:
#
# class Class
# alias old_new new
Expand All @@ -26,7 +27,7 @@
#
# n = Name.new
#
# *produces:*
# <em>produces:</em>
#
# Creating a new Name
#
Expand Down Expand Up @@ -144,7 +145,7 @@ class Class < Module
# class Baz < Bar
# end
#
# *produces:*
# <em>produces:</em>
#
# New subclass: Bar
# New subclass: Baz
Expand All @@ -157,7 +158,7 @@ class Class < Module
# -->
# Calls #allocate to create a new object of *class*'s class, then invokes that
# object's #initialize method, passing it *args*. This is the method that ends
# up getting called whenever an object is constructed using `.new`.
# up getting called whenever an object is constructed using <code>.new</code>.
#
def new: () -> untyped

Expand Down
66 changes: 36 additions & 30 deletions core/comparable.rbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# <!-- rdoc-file=compar.c -->
# The Comparable mixin is used by classes whose objects may be ordered. The
# class must define the `<=>` operator, which compares the receiver against
# another object, returning a value less than 0, returning 0, or returning a
# value greater than 0, depending on whether the receiver is less than, equal
# to, or greater than the other object. If the other object is not comparable
# then the `<=>` operator should return `nil`. Comparable uses `<=>` to
# implement the conventional comparison operators (`<`, `<=`, `==`, `>=`, and
# `>`) and the method `between?`.
# class must define the <code><=></code> operator, which compares the receiver
# against another object, returning a value less than 0, returning 0, or
# returning a value greater than 0, depending on whether the receiver is less
# than, equal to, or greater than the other object. If the other object is not
# comparable then the <code><=></code> operator should return `nil`. Comparable
# uses <code><=></code> to implement the conventional comparison operators
# (<code><</code>, <code><=</code>, <code>==</code>, <code>>=</code>, and
# <code>></code>) and the method <code>between?</code>.
#
# class StringSorter
# include Comparable
Expand Down Expand Up @@ -38,27 +39,29 @@
#
# ## What's Here
#
# Module Comparable provides these methods, all of which use method `#<=>`:
# Module Comparable provides these methods, all of which use method
# <code>#<=></code>:
#
# * #<: Returns whether `self` is less than the given object.
# * #<=: Returns whether `self` is less than or equal to the given object.
# * #==: Returns whether `self` is equal to the given object.
# * #>: Returns whether `self` is greater than the given object.
# * #>=: Returns whether `self` is greater than or equal to the given object.
# * #between?: Returns `true` if `self` is between two given objects.
# * #clamp: For given objects `min` and `max`, or range `(min..max)`, returns:
# * #clamp: For given objects `min` and `max`, or range
# <code>(min..max)</code>, returns:
#
# * `min` if `(self <=> min) < 0`.
# * `max` if `(self <=> max) > 0`.
# * `min` if <code>(self <=> min) < 0</code>.
# * `max` if <code>(self <=> max) > 0</code>.
# * `self` otherwise.
#
module Comparable : _WithSpaceshipOperator
# <!--
# rdoc-file=compar.c
# - self < other -> true or false
# -->
# Returns whether `self` is "less than" `other`; equivalent to `(self <=> other)
# < 0`:
# Returns whether `self` is "less than" `other`; equivalent to <code>(self <=>
# other) < 0</code>:
#
# 'foo' < 'foo' # => false
# 'foo' < 'food' # => true
Expand All @@ -70,7 +73,7 @@ module Comparable : _WithSpaceshipOperator
# - self <= other -> true or false
# -->
# Returns whether `self` is "less than or equal to" `other`; equivalent to
# `(self <=> other) <= 0`:
# <code>(self <=> other) <= 0</code>:
#
# 'foo' <= 'foo' # => true
# 'foo' <= 'food' # => true
Expand All @@ -82,35 +85,36 @@ module Comparable : _WithSpaceshipOperator
# rdoc-file=compar.c
# - obj == other -> true or false
# -->
# Compares two objects based on the receiver's `<=>` method, returning true if
# it returns 0. Also returns true if *obj* and *other* are the same object.
# Compares two objects based on the receiver's <code><=></code> method,
# returning true if it returns 0. Also returns true if *obj* and *other* are the
# same object.
#
def ==: (untyped other) -> bool

# <!--
# rdoc-file=compar.c
# - obj > other -> true or false
# -->
# Compares two objects based on the receiver's `<=>` method, returning true if
# it returns a value greater than 0.
# Compares two objects based on the receiver's <code><=></code> method,
# returning true if it returns a value greater than 0.
#
def >: (untyped other) -> bool

# <!--
# rdoc-file=compar.c
# - obj >= other -> true or false
# -->
# Compares two objects based on the receiver's `<=>` method, returning true if
# it returns a value greater than or equal to 0.
# Compares two objects based on the receiver's <code><=></code> method,
# returning true if it returns a value greater than or equal to 0.
#
def >=: (untyped other) -> bool

# <!--
# rdoc-file=compar.c
# - obj.between?(min, max) -> true or false
# -->
# Returns `false` if *obj* `<=>` *min* is less than zero or if *obj* `<=>` *max*
# is greater than zero, `true` otherwise.
# Returns `false` if *obj* <code><=></code> *min* is less than zero or if *obj*
# <code><=></code> *max* is greater than zero, `true` otherwise.
#
# 3.between?(1, 5) #=> true
# 6.between?(1, 5) #=> false
Expand All @@ -124,8 +128,9 @@ module Comparable : _WithSpaceshipOperator
# - obj.clamp(min, max) -> obj
# - obj.clamp(range) -> obj
# -->
# In `(min, max)` form, returns *min* if *obj* `<=>` *min* is less than zero,
# *max* if *obj* `<=>` *max* is greater than zero, and *obj* otherwise.
# In <code>(min, max)</code> form, returns *min* if *obj* <code><=></code> *min*
# is less than zero, *max* if *obj* <code><=></code> *max* is greater than zero,
# and *obj* otherwise.
#
# 12.clamp(0, 100) #=> 12
# 523.clamp(0, 100) #=> 100
Expand All @@ -140,9 +145,10 @@ module Comparable : _WithSpaceshipOperator
# -20.clamp(0, nil) #=> 0
# 523.clamp(nil, 100) #=> 100
#
# In `(range)` form, returns *range.begin* if *obj* `<=>` *range.begin* is less
# than zero, *range.end* if *obj* `<=>` *range.end* is greater than zero, and
# *obj* otherwise.
# In <code>(range)</code> form, returns <em>range.begin</em> if *obj*
# <code><=></code> <em>range.begin</em> is less than zero, <em>range.end</em> if
# *obj* <code><=></code> <em>range.end</em> is greater than zero, and *obj*
# otherwise.
#
# 12.clamp(0..100) #=> 12
# 523.clamp(0..100) #=> 100
Expand All @@ -151,13 +157,13 @@ module Comparable : _WithSpaceshipOperator
# 'd'.clamp('a'..'f') #=> 'd'
# 'z'.clamp('a'..'f') #=> 'f'
#
# If *range.begin* is `nil`, it is considered smaller than *obj*, and if
# *range.end* is `nil`, it is considered greater than *obj*.
# If <em>range.begin</em> is `nil`, it is considered smaller than *obj*, and if
# <em>range.end</em> is `nil`, it is considered greater than *obj*.
#
# -20.clamp(0..) #=> 0
# 523.clamp(..100) #=> 100
#
# When *range.end* is excluded and not `nil`, an exception is raised.
# When <em>range.end</em> is excluded and not `nil`, an exception is raised.
#
# 100.clamp(0...100) # ArgumentError
#
Expand Down
Loading