core/range.rbs in rbs-1.3.3 vs core/range.rbs in rbs-1.4.0
- old
+ new
@@ -99,11 +99,13 @@
# ```ruby
# (1..10).begin #=> 1
# ```
def begin: () -> Elem # Begin-less ranges have type of Range[Integer?]
- def bsearch: [U] () { (Elem) -> boolish } -> U?
+ def bsearch: () -> ::Enumerator[Elem, Elem?]
+ | () { (Elem) -> (true | false) } -> Elem?
+ | () { (Elem) -> ::Integer } -> Elem?
def cover?: (untyped obj) -> bool
def each: () { (Elem arg0) -> untyped } -> self
| () -> ::Enumerator[Elem, self]
@@ -130,11 +132,11 @@
# ```ruby
# (10..20).first #=> 10
# (10..20).first(3) #=> [10, 11, 12]
# ```
def first: () -> Elem
- | (?Integer n) -> ::Array[Elem]
+ | (Integer n) -> ::Array[Elem]
# Compute a hash-code for this range. Two ranges with equal begin and end
# points (using `eql?` ), and the same
# [exclude\_end?](Range.downloaded.ruby_doc#method-i-exclude_end-3F) value
# will generate the same hash-code.
@@ -163,11 +165,11 @@
# (10...20).last #=> 20
# (10..20).last(3) #=> [18, 19, 20]
# (10...20).last(3) #=> [17, 18, 19]
# ```
def last: () -> Elem
- | (?Integer n) -> ::Array[Elem]
+ | (Integer n) -> ::Array[Elem]
# Returns the maximum value in the range. Returns `nil` if the begin value
# of the range larger than the end value. Returns `nil` if the begin value
# of an exclusive range is equal to the end value.
#
@@ -176,13 +178,13 @@
#
# ```ruby
# (10..20).max #=> 20
# ```
def max: () -> Elem
- | () { (Elem arg0, Elem arg1) -> Integer } -> Elem
- | (?Integer n) -> ::Array[Elem]
- | (?Integer n) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
+ | () { (Elem a, Elem b) -> Integer } -> Elem
+ | (Integer n) -> ::Array[Elem]
+ | (Integer n) { (Elem a, Elem b) -> Integer } -> ::Array[Elem]
# Returns the minimum value in the range. Returns `nil` if the begin value
# of the range is larger than the end value. Returns `nil` if the begin
# value of an exclusive range is equal to the end value.
#
@@ -191,12 +193,12 @@
#
# ```ruby
# (10..20).min #=> 10
# ```
def min: () -> Elem
- | () { (Elem arg0, Elem arg1) -> Integer } -> Elem
- | (?Integer n) -> ::Array[Elem]
- | (?Integer n) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
+ | () { (Elem a, Elem b) -> Integer } -> Elem
+ | (Integer n) -> ::Array[Elem]
+ | (Integer n) { (Elem a, Elem b) -> Integer } -> ::Array[Elem]
# Returns the number of elements in the range. Both the begin and the end
# of the [Range](Range.downloaded.ruby_doc) must be
# [Numeric](https://ruby-doc.org/core-2.6.3/Numeric.html), otherwise nil
# is returned.