diff --git a/Gemfile.lock b/Gemfile.lock index d5410b93b..6e1bc6f7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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 @@ -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) diff --git a/core/array.rbs b/core/array.rbs index 887c1a6c9..25ce493b5 100644 --- a/core/array.rbs +++ b/core/array.rbs @@ -376,10 +376,10 @@ # * #find_index (aliased as #index): Returns the index of the first element # that meets a given criterion. # * #hash: Returns the integer hash code. -# * #include?: Returns whether any element `==` a given object. +# * #include?: Returns whether any element == a given object. # * #length (aliased as #size): Returns the count of elements. -# * #none?: Returns whether no element `==` a given object. -# * #one?: Returns whether exactly one element `==` a given object. +# * #none?: Returns whether no element == a given object. +# * #one?: Returns whether exactly one element == a given object. # * #rindex: Returns the index of the last element that meets a given # criterion. # @@ -387,9 +387,9 @@ # # * #<=>: Returns -1, 0, or 1, as `self` is less than, equal to, or greater # than a given object. -# * #==: Returns whether each element in `self` is `==` to the corresponding -# element in a given object. -# * #eql?: Returns whether each element in `self` is `eql?` to the +# * #==: Returns whether each element in `self` is == to the +# corresponding element in a given object. +# * #eql?: Returns whether each element in `self` is eql? to the # corresponding element in a given object. # # ### Methods for Fetching @@ -399,7 +399,7 @@ # * #[] (aliased as #slice): Returns consecutive elements as determined by a # given argument. # * #assoc: Returns the first element that is an array whose first element -# `==` a given object. +# == a given object. # * #at: Returns the element at a given offset. # * #bsearch: Returns an element selected via a binary search as determined by # a given block. @@ -414,14 +414,14 @@ # * #fetch_values: Returns elements at given offsets. # * #first: Returns one or more leading elements. # * #last: Returns one or more trailing elements. -# * #max: Returns one or more maximum-valued elements, as determined by `#<=>` -# or a given block. -# * #min: Returns one or more minimum-valued elements, as determined by `#<=>` -# or a given block. +# * #max: Returns one or more maximum-valued elements, as determined by +# #<=> or a given block. +# * #min: Returns one or more minimum-valued elements, as determined by +# #<=> or a given block. # * #minmax: Returns the minimum-valued and maximum-valued elements, as -# determined by `#<=>` or a given block. +# determined by #<=> or a given block. # * #rassoc: Returns the first element that is an array whose second element -# `==` a given object. +# == a given object. # * #reject: Returns an array containing elements not rejected by a given # block. # * #reverse: Returns all elements in reverse order. @@ -430,8 +430,8 @@ # * #select (aliased as #filter): Returns an array containing elements # selected by a given block. # * #shuffle: Returns elements in a random order. -# * #sort: Returns all elements in an order determined by `#<=>` or a given -# block. +# * #sort: Returns all elements in an order determined by #<=> or +# a given block. # * #take: Returns leading elements as determined by a given index. # * #take_while: Returns leading elements as determined by a given block. # * #uniq: Returns an array containing non-duplicate elements. @@ -455,8 +455,8 @@ # * #reverse!: Replaces `self` with its elements reversed. # * #rotate!: Replaces `self` with its elements rotated. # * #shuffle!: Replaces `self` with its elements in random order. -# * #sort!: Replaces `self` with its elements sorted, as determined by `#<=>` -# or a given block. +# * #sort!: Replaces `self` with its elements sorted, as determined by +# #<=> or a given block. # * #sort_by!: Replaces `self` with its elements sorted, as determined by a # given block. # * #unshift (aliased as #prepend): Prepends leading elements. @@ -539,10 +539,11 @@ # * With integer argument `n`, a new array that is the concatenation of # `n` copies of `self`. # * With string argument `field_separator`, a new string that is -# equivalent to `join(field_separator)`. +# equivalent to join(field_separator). # # * #pack: Packs the elements into a binary sequence. -# * #sum: Returns a sum of elements according to either `+` or a given block. +# * #sum: Returns a sum of elements according to either + or a +# given block. # %a{annotate:rdoc:source:from=array.c} class Array[unchecked out Elem] < Object @@ -574,8 +575,8 @@ class Array[unchecked out Elem] < Object # Array.new(2, 3) # => [3, 3] # # With a block given, returns an array of the given `size`; calls the block with - # each `index` in the range `(0...size)`; the element at that `index` in the - # returned array is the blocks return value: + # each `index` in the range (0...size); the element at that `index` + # in the returned array is the blocks return value: # # Array.new(3) {|index| "Element #{index}" } # => ["Element 0", "Element 1", "Element 2"] # @@ -630,9 +631,9 @@ class Array[unchecked out Elem] < Object # # If `object` is an array, returns `object`. # - # Otherwise if `object` responds to `:to_ary`. calls `object.to_ary`: if the - # return value is an array or `nil`, returns that value; if not, raises - # TypeError. + # Otherwise if `object` responds to :to_ary. calls + # object.to_ary: if the return value is an array or `nil`, returns + # that value; if not, raises TypeError. # # Otherwise returns `nil`. # @@ -658,8 +659,8 @@ class Array[unchecked out Elem] < Object # # [0, 1, 2] & [3, 2, 1, 0] # => [0, 1, 2] # - # Identifies common elements using method `#eql?` (as defined in each element of - # `self`). + # Identifies common elements using method #eql? (as defined in each + # element of `self`). # # Related: see [Methods for Combining](rdoc-ref:Array@Methods+for+Combining). # @@ -677,7 +678,7 @@ class Array[unchecked out Elem] < Object # a * 3 # => ["x", "y", "x", "y", "x", "y"] # # When string argument `string_separator` is given, equivalent to - # `self.join(string_separator)`: + # self.join(string_separator): # # [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}" # @@ -709,8 +710,8 @@ class Array[unchecked out Elem] < Object # [0, 1, 1, 2, 1, 1, 3, 1, 1] - [3, 2, 0, :foo] # => [1, 1, 1, 1, 1, 1] # [0, 1, 2] - [:foo] # => [0, 1, 2] # - # Element are compared using method `#eql?` (as defined in each element of - # `self`). + # Element are compared using method #eql? (as defined in each + # element of `self`). # # Related: see [Methods for Combining](rdoc-ref:Array@Methods+for+Combining). # @@ -739,21 +740,22 @@ class Array[unchecked out Elem] < Object # Returns -1, 0, or 1 as `self` is determined to be less than, equal to, or # greater than `other_array`. # - # Iterates over each index `i` in `(0...self.size)`: + # Iterates over each index `i` in (0...self.size): # - # * Computes `result[i]` as `self[i] <=> other_array[i]`. - # * Immediately returns 1 if `result[i]` is 1: + # * Computes result[i] as self[i] <=> + # other_array[i]. + # * Immediately returns 1 if result[i] is 1: # # [0, 1, 2] <=> [0, 0, 2] # => 1 # - # * Immediately returns -1 if `result[i]` is -1: + # * Immediately returns -1 if result[i] is -1: # # [0, 1, 2] <=> [0, 2, 2] # => -1 # - # * Continues if `result[i]` is 0. + # * Continues if result[i] is 0. # - # When every `result` is 0, returns `self.size <=> other_array.size` (see - # Integer#<=>): + # When every `result` is 0, returns self.size <=> other_array.size + # (see Integer#<=>): # # [0, 1, 2] <=> [0, 1] # => 1 # [0, 1, 2] <=> [0, 1, 2] # => 0 @@ -778,7 +780,7 @@ class Array[unchecked out Elem] < Object # # * `self` and `other_array` are the same size. # * Their corresponding elements are the same; that is, for each index `i` in - # `(0...self.size)`, `self[i] == other_array[i]`. + # (0...self.size), self[i] == other_array[i]. # # Examples: # @@ -788,7 +790,7 @@ class Array[unchecked out Elem] < Object # [:foo, 'bar', 2] == [:foo, 'bar', 3] # => false # Different elements. # # This method is different from method Array#eql?, which compares elements using - # `Object#eql?`. + # Object#eql?. # # Related: see [Methods for Comparing](rdoc-ref:Array@Methods+for+Comparing). # @@ -847,42 +849,45 @@ class Array[unchecked out Elem] < Object # a[0, 2] # => [:foo, "bar"] # a[1, 2] # => ["bar", 2] # - # If `start + length` is greater than `self.length`, returns all elements from - # offset `start` to the end: + # If start + length is greater than self.length, + # returns all elements from offset `start` to the end: # # a = [:foo, 'bar', 2] # a[0, 4] # => [:foo, "bar", 2] # a[1, 3] # => ["bar", 2] # a[2, 2] # => [2] # - # If `start == self.size` and `length >= 0`, returns a new empty array. + # If start == self.size and length >= 0, returns a new + # empty array. # # If `length` is negative, returns `nil`. # - # When a single Range argument `range` is given, treats `range.min` as `start` - # above and `range.size` as `length` above: + # When a single Range argument `range` is given, treats range.min + # as `start` above and range.size as `length` above: # # a = [:foo, 'bar', 2] # a[0..1] # => [:foo, "bar"] # a[1..2] # => ["bar", 2] # - # Special case: If `range.start == a.size`, returns a new empty array. + # Special case: If range.start == a.size, returns a new empty + # array. # - # If `range.end` is negative, calculates the end index from the end: + # If range.end is negative, calculates the end index from the end: # # a = [:foo, 'bar', 2] # a[0..-1] # => [:foo, "bar", 2] # a[0..-2] # => [:foo, "bar"] # a[0..-3] # => [:foo] # - # If `range.start` is negative, calculates the start index from the end: + # If range.start is negative, calculates the start index from the + # end: # # a = [:foo, 'bar', 2] # a[-1..2] # => [2] # a[-2..2] # => ["bar", 2] # a[-3..2] # => [:foo, "bar", 2] # - # If `range.start` is larger than the array size, returns `nil`. + # If range.start is larger than the array size, returns `nil`. # # a = [:foo, 'bar', 2] # a[4..1] # => nil @@ -962,7 +967,7 @@ class Array[unchecked out Elem] < Object # a[0] = 'foo' # => "foo" # a # => ["foo", "bar", 2] # - # If `index` is greater than `self.length`, extends the array: + # If `index` is greater than self.length, extends the array: # # a = [:foo, 'bar', 2] # a[7] = 'foo' # => "foo" @@ -975,8 +980,8 @@ class Array[unchecked out Elem] < Object # a # => [:foo, "bar", "two"] # # When Integer arguments `start` and `length` are given and `object` is not an - # array, removes `length - 1` elements beginning at offset `start`, and assigns - # `object` at offset `start`: + # array, removes length - 1 elements beginning at offset `start`, + # and assigns `object` at offset `start`: # # a = [:foo, 'bar', 2] # a[0, 2] = 'foo' # => "foo" @@ -988,8 +993,8 @@ class Array[unchecked out Elem] < Object # a[-2, 2] = 'foo' # => "foo" # a # => [:foo, "foo"] # - # If `start` is non-negative and outside the array (` >= self.size`), extends - # the array with `nil`, assigns `object` at offset `start`, and ignores + # If `start` is non-negative and outside the array ( >= self.size), + # extends the array with `nil`, assigns `object` at offset `start`, and ignores # `length`: # # a = [:foo, 'bar', 2] @@ -1010,35 +1015,38 @@ class Array[unchecked out Elem] < Object # a # => [:foo, "foo"] # # When Range argument `range` is given and `object` is not an array, removes - # `length - 1` elements beginning at offset `start`, and assigns `object` at - # offset `start`: + # length - 1 elements beginning at offset `start`, and assigns + # `object` at offset `start`: # # a = [:foo, 'bar', 2] # a[0..1] = 'foo' # => "foo" # a # => ["foo", 2] # - # if `range.begin` is negative, counts backwards from the end of the array: + # if range.begin is negative, counts backwards from the end of the + # array: # # a = [:foo, 'bar', 2] # a[-2..2] = 'foo' # => "foo" # a # => [:foo, "foo"] # - # If the array length is less than `range.begin`, extends the array with `nil`, - # assigns `object` at offset `range.begin`, and ignores `length`: + # If the array length is less than range.begin, extends the array + # with `nil`, assigns `object` at offset range.begin, and ignores + # `length`: # # a = [:foo, 'bar', 2] # a[6..50] = 'foo' # => "foo" # a # => [:foo, "bar", 2, nil, nil, nil, "foo"] # - # If `range.end` is zero, shifts elements at and following offset `start` and - # assigns `object` at offset `start`: + # If range.end is zero, shifts elements at and following offset + # `start` and assigns `object` at offset `start`: # # a = [:foo, 'bar', 2] # a[1..0] = 'foo' # => "foo" # a # => [:foo, "foo", "bar", 2] # - # If `range.end` is negative, assigns `object` at offset `start`, retains - # `range.end.abs -1` elements past that, and removes those beyond: + # If range.end is negative, assigns `object` at offset `start`, + # retains range.end.abs -1 elements past that, and removes those + # beyond: # # a = [:foo, 'bar', 2] # a[1..-1] = 'foo' # => "foo" @@ -1051,8 +1059,8 @@ class Array[unchecked out Elem] < Object # a # => [:foo, "foo", "bar", 2] # a = [:foo, 'bar', 2] # - # If `range.end` is too large for the existing array, replaces array elements, - # but does not extend the array with `nil` values: + # If range.end is too large for the existing array, replaces array + # elements, but does not extend the array with `nil` values: # # a = [:foo, 'bar', 2] # a[1..5] = 'foo' # => "foo" @@ -1083,8 +1091,8 @@ class Array[unchecked out Elem] < Object # [[], {}, '', 0, 0.0, nil].all? # => false # nil is not truthy. # [[], {}, '', 0, 0.0, false].all? # => false # false is not truthy. # - # With argument `object` given, returns whether `object === ele` for every - # element `ele` in `self`: + # With argument `object` given, returns whether object === ele for + # every element `ele` in `self`: # # [0, 0, 0].all?(0) # => true # [0, 1, 2].all?(1) # => false @@ -1125,8 +1133,8 @@ class Array[unchecked out Elem] < Object # [nil, false, ''].any? # => true # String object is truthy. # [nil, false].any? # => false # Nil and false are not truthy. # - # With argument `object` given, returns whether `object === ele` for any element - # `ele` in `self`: + # With argument `object` given, returns whether object === ele for + # any element `ele` in `self`: # # [nil, false, 0].any?(0) # => true # [nil, false, 1].any?(0) # => false @@ -1169,7 +1177,7 @@ class Array[unchecked out Elem] < Object # - assoc(object) -> found_array or nil # --> # Returns the first element `ele` in `self` such that `ele` is an array and - # `ele[0] == object`: + # ele[0] == object: # # a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]] # a.assoc(4) # => [4, 5, 6] @@ -1299,8 +1307,8 @@ class Array[unchecked out Elem] < Object # --> # When a block and a positive [integer-convertible # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects) - # argument `count` (`0 < count <= self.size`) are given, calls the block with - # each combination of `self` of size `count`; returns `self`: + # argument `count` (0 < count <= self.size) are given, calls the + # block with each combination of `self` of size `count`; returns `self`: # # a = %w[a b c] # => ["a", "b", "c"] # a.combination(2) {|combination| p combination } # => ["a", "b", "c"] @@ -1323,8 +1331,8 @@ class Array[unchecked out Elem] < Object # [] # [] # - # When `count` is negative or larger than `self.size` and `self` is non-empty, - # does not call the block: + # When `count` is negative or larger than self.size and `self` is + # non-empty, does not call the block: # # a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"] # a.combination(4) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"] @@ -1395,7 +1403,8 @@ class Array[unchecked out Elem] < Object # # [0, :one, 'two', 3, 3.0].count # => 5 # - # With argument `object` given, returns the count of elements `==` to `object`: + # With argument `object` given, returns the count of elements == to + # `object`: # # [0, :one, 'two', 3, 3.0].count(3) # => 2 # @@ -1405,7 +1414,7 @@ class Array[unchecked out Elem] < Object # [0, 1, 2, 3].count {|element| element > 1 } # => 2 # # With argument `object` and a block given, issues a warning, ignores the block, - # and returns the count of elements `==` to `object`. + # and returns the count of elements == to `object`. # # Related: see [Methods for Querying](rdoc-ref:Array@Methods+for+Querying). # @@ -1462,8 +1471,8 @@ class Array[unchecked out Elem] < Object # --> # Removes zero or more elements from `self`. # - # With no block given, removes from `self` each element `ele` such that `ele == - # object`; returns the last removed element: + # With no block given, removes from `self` each element `ele` such that + # ele == object; returns the last removed element: # # a = [0, 1, 2, 2.0] # a.delete(2) # => 2.0 @@ -1473,8 +1482,8 @@ class Array[unchecked out Elem] < Object # # a.delete(2) # => nil # - # With a block given, removes from `self` each element `ele` such that `ele == - # object`. + # With a block given, removes from `self` each element `ele` such that ele + # == object. # # If any such elements are found, ignores the block and returns the last removed # element: @@ -1546,8 +1555,8 @@ class Array[unchecked out Elem] < Object # - difference(*other_arrays = []) -> new_array # --> # Returns a new array containing only those elements from `self` that are not - # found in any of the given `other_arrays`; items are compared using `eql?`; - # order from `self` is preserved: + # found in any of the given `other_arrays`; items are compared using + # eql?; order from `self` is preserved: # # [0, 1, 1, 2, 1, 1, 3, 1, 1].difference([1]) # => [0, 2, 3] # [0, 1, 2, 3].difference([3, 0], [1, 3]) # => [2] @@ -1705,7 +1714,7 @@ class Array[unchecked out Elem] < Object # - eql?(other_array) -> true or false # --> # Returns `true` if `self` and `other_array` are the same size, and if, for each - # index `i` in `self`, `self[i].eql?(other_array[i])`: + # index `i` in `self`, self[i].eql?(other_array[i]): # # a0 = [:foo, 'bar', 2] # a1 = [:foo, 'bar', 2] @@ -1714,7 +1723,7 @@ class Array[unchecked out Elem] < Object # Otherwise, returns `false`. # # This method is different from method Array#==, which compares using method - # `Object#==`. + # Object#==. # # Related: see [Methods for Querying](rdoc-ref:Array@Methods+for+Querying). # @@ -2055,7 +2064,7 @@ class Array[unchecked out Elem] < Object # Returns the zero-based integer index of a specified element, or `nil`. # # With only argument `object` given, returns the index of the first element - # `element` for which `object == element`: + # `element` for which object == element: # # a = [:foo, 'bar', 2, 'bar'] # a.index('bar') # => 1 @@ -2197,7 +2206,8 @@ class Array[unchecked out Elem] < Object # rdoc-file=array.c # - include?(object) -> true or false # --> - # Returns whether for some element `element` in `self`, `object == element`: + # Returns whether for some element `element` in `self`, object == + # element: # # [0, 1, 2].include?(2) # => true # [0, 1, 2].include?(2.0) # => true @@ -2211,7 +2221,7 @@ class Array[unchecked out Elem] < Object # Returns the zero-based integer index of a specified element, or `nil`. # # With only argument `object` given, returns the index of the first element - # `element` for which `object == element`: + # `element` for which object == element: # # a = [:foo, 'bar', 2, 'bar'] # a.index('bar') # => 1 @@ -2244,13 +2254,14 @@ class Array[unchecked out Elem] < Object # a = ['a', 'b', 'c'] # => ["a", "b", "c"] # a.insert(1, :x, :y, :z) # => ["a", :x, :y, :z, "b", "c"] # - # Extends the array if `index` is beyond the array (`index >= self.size`): + # Extends the array if `index` is beyond the array (index >= + # self.size): # # a = ['a', 'b', 'c'] # => ["a", "b", "c"] # a.insert(5, :x, :y, :z) # => ["a", "b", "c", nil, nil, :x, :y, :z] # # When `index` is negative, inserts `objects` *after* the element at offset - # `index + self.size`: + # index + self.size: # # a = ['a', 'b', 'c'] # => ["a", "b", "c"] # a.insert(-2, :x, :y, :z) # => ["a", "b", :x, :y, :z, "c"] @@ -2274,8 +2285,8 @@ class Array[unchecked out Elem] < Object # - inspect -> new_string # - to_s -> new_string # --> - # Returns the new string formed by calling method `#inspect` on each array - # element: + # Returns the new string formed by calling method #inspect on each + # array element: # # a = [:foo, 'bar', 2] # a.inspect # => "[:foo, \"bar\", 2]" @@ -2288,13 +2299,13 @@ class Array[unchecked out Elem] < Object # rdoc-file=array.c # - intersect?(other_array) -> true or false # --> - # Returns whether `other_array` has at least one element that is `#eql?` to some - # element of `self`: + # Returns whether `other_array` has at least one element that is + # #eql? to some element of `self`: # # [1, 2, 3].intersect?([3, 4, 5]) # => true # [1, 2, 3].intersect?([4, 5, 6]) # => false # - # Each element must correctly implement method `#hash`. + # Each element must correctly implement method #hash. # # Related: see [Methods for Querying](rdoc-ref:Array@Methods+for+Querying). # @@ -2304,12 +2315,13 @@ class Array[unchecked out Elem] < Object # rdoc-file=array.c # - intersection(*other_arrays) -> new_array # --> - # Returns a new array containing each element in `self` that is `#eql?` to at - # least one element in each of the given `other_arrays`; duplicates are omitted: + # Returns a new array containing each element in `self` that is + # #eql? to at least one element in each of the given + # `other_arrays`; duplicates are omitted: # # [0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1] # - # Each element must correctly implement method `#hash`. + # Each element must correctly implement method #hash. # # Order from `self` is preserved: # @@ -2328,11 +2340,12 @@ class Array[unchecked out Elem] < Object # Returns the new string formed by joining the converted elements of `self`; for # each element `element`: # - # * Converts recursively using `element.join(separator)` if `element` is a - # `kind_of?(Array)`. - # * Otherwise, converts using `element.to_s`. + # * Converts recursively using element.join(separator) if + # `element` is a kind_of?(Array). + # * Otherwise, converts using element.to_s. # - # With no argument given, joins using the output field separator, `$,`: + # With no argument given, joins using the output field separator, + # $,: # # a = [:foo, 'bar', 2] # $, # => nil @@ -2455,16 +2468,17 @@ class Array[unchecked out Elem] < Object # # Does not modify `self`. # - # With no block given, each element in `self` must respond to method `#<=>` with - # a numeric. + # With no block given, each element in `self` must respond to method + # #<=> with a numeric. # # With no argument and no block, returns the element in `self` having the - # maximum value per method `#<=>`: + # maximum value per method #<=>: # # [1, 0, 3, 2].max # => 3 # # With non-negative numeric argument `count` and no block, returns a new array - # with at most `count` elements, in descending order, per method `#<=>`: + # with at most `count` elements, in descending order, per method + # #<=>: # # [1, 0, 3, 2].max(3) # => [3, 2, 1] # [1, 0, 3, 2].max(3.0) # => [3, 2, 1] @@ -2473,8 +2487,9 @@ class Array[unchecked out Elem] < Object # # With a block given, the block must return a numeric. # - # With a block and no argument, calls the block `self.size - 1` times to compare - # elements; returns the element having the maximum value per the block: + # With a block and no argument, calls the block self.size - 1 times + # to compare elements; returns the element having the maximum value per the + # block: # # ['0', '', '000', '00'].max {|a, b| a.size <=> b.size } # # => "000" @@ -2506,16 +2521,17 @@ class Array[unchecked out Elem] < Object # # Does not modify `self`. # - # With no block given, each element in `self` must respond to method `#<=>` with - # a numeric. + # With no block given, each element in `self` must respond to method + # #<=> with a numeric. # # With no argument and no block, returns the element in `self` having the - # minimum value per method `#<=>`: + # minimum value per method #<=>: # # [1, 0, 3, 2].min # => 0 # # With non-negative numeric argument `count` and no block, returns a new array - # with at most `count` elements, in ascending order, per method `#<=>`: + # with at most `count` elements, in ascending order, per method + # #<=>: # # [1, 0, 3, 2].min(3) # => [0, 1, 2] # [1, 0, 3, 2].min(3.0) # => [0, 1, 2] @@ -2524,8 +2540,9 @@ class Array[unchecked out Elem] < Object # # With a block given, the block must return a numeric. # - # With a block and no argument, calls the block `self.size - 1` times to compare - # elements; returns the element having the minimum value per the block: + # With a block and no argument, calls the block self.size - 1 times + # to compare elements; returns the element having the minimum value per the + # block: # # ['0', '', '000', '00'].min {|a, b| a.size <=> b.size } # # => "" @@ -2549,13 +2566,13 @@ class Array[unchecked out Elem] < Object # elements from `self`; does not modify `self`. # # With no block given, the minimum and maximum values are determined using - # method `#<=>`: + # method #<=>: # # [1, 0, 3, 2].minmax # => [0, 3] # # With a block given, the block must return a numeric; the block is called - # `self.size - 1` times to compare elements; returns the elements having the - # minimum and maximum values per the block: + # self.size - 1 times to compare elements; returns the elements + # having the minimum and maximum values per the block: # # ['0', '', '000', '00'].minmax {|a, b| a.size <=> b.size } # # => ["", "000"] @@ -2582,7 +2599,7 @@ class Array[unchecked out Elem] < Object # [].none? # => true # # With argument `object` given, returns `false` if for any element `element`, - # `object === element`; `true` otherwise: + # object === element; `true` otherwise: # # ['food', 'drink'].none?(/bar/) # => true # ['food', 'drink'].none?(/foo/) # => false @@ -2624,7 +2641,7 @@ class Array[unchecked out Elem] < Object # [0, 1, 2].one? {|element| element > 2 } # => false # # With argument `object` given, returns `true` if for exactly one element - # `element`, `object === element`; `false` otherwise: + # `element`, object === element; `false` otherwise: # # [0, 1, 2].one?(0) # => true # [0, 0, 1].one?(0) # => false @@ -2654,9 +2671,9 @@ class Array[unchecked out Elem] < Object # Iterates over permutations of the elements of `self`; the order of # permutations is indeterminate. # - # With a block and an in-range positive integer argument `count` (`0 < count <= - # self.size`) given, calls the block with each permutation of `self` of size - # `count`; returns `self`: + # With a block and an in-range positive integer argument `count` (0 < + # count <= self.size) given, calls the block with each permutation of + # `self` of size `count`; returns `self`: # # a = [0, 1, 2] # perms = [] @@ -2677,8 +2694,8 @@ class Array[unchecked out Elem] < Object # a.permutation(0) {|perm| perms.push(perm) } # perms # => [[]] # - # When `count` is out of range (negative or larger than `self.size`), does not - # call the block: + # When `count` is out of range (negative or larger than self.size), + # does not call the block: # # a.permutation(-1) {|permutation| fail 'Cannot happen' } # a.permutation(4) {|permutation| fail 'Cannot happen' } @@ -2815,7 +2832,7 @@ class Array[unchecked out Elem] < Object # - rassoc(object) -> found_array or nil # --> # Returns the first element `ele` in `self` such that `ele` is an array and - # `ele[1] == object`: + # ele[1] == object: # # a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]] # a.rassoc(4) # => [2, 4] @@ -2879,7 +2896,7 @@ class Array[unchecked out Elem] < Object # # If a positive integer argument `size` is given, calls the block with each # `size`-tuple repeated combination of the elements of `self`. The number of - # combinations is `(size+1)(size+2)/2`. + # combinations is (size+1)(size+2)/2. # # Examples: # @@ -2919,7 +2936,7 @@ class Array[unchecked out Elem] < Object # # If a positive integer argument `size` is given, calls the block with each # `size`-tuple repeated permutation of the elements of `self`. The number of - # permutations is `self.size**size`. + # permutations is self.size**size. # # Examples: # @@ -3043,7 +3060,8 @@ class Array[unchecked out Elem] < Object # - rindex {|element| ... } -> integer or nil # - rindex -> new_enumerator # --> - # Returns the index of the last element for which `object == element`. + # Returns the index of the last element for which object == + # element. # # With argument `object` given, returns the index of the last such element # found: @@ -3082,7 +3100,7 @@ class Array[unchecked out Elem] < Object # [0, 1, 2, 3].rotate(2) # => [2, 3, 0, 1] # [0, 1, 2, 3].rotate(2.1) # => [2, 3, 0, 1] # - # If `count` is large, uses `count % array.size` as the count: + # If `count` is large, uses count % array.size as the count: # # [0, 1, 2, 3].rotate(22) # => [2, 3, 0, 1] # @@ -3095,7 +3113,8 @@ class Array[unchecked out Elem] < Object # # [0, 1, 2, 3].rotate(-1) # => [3, 0, 1, 2] # - # If `count` is small (far from zero), uses `count % array.size` as the count: + # If `count` is small (far from zero), uses count % array.size as + # the count: # # [0, 1, 2, 3].rotate(-21) # => [3, 0, 1, 2] # @@ -3116,7 +3135,7 @@ class Array[unchecked out Elem] < Object # [0, 1, 2, 3].rotate!(2) # => [2, 3, 0, 1] # [0, 1, 2, 3].rotate!(2.1) # => [2, 3, 0, 1] # - # If `count` is large, uses `count % array.size` as the count: + # If `count` is large, uses count % array.size as the count: # # [0, 1, 2, 3].rotate!(21) # => [1, 2, 3, 0] # @@ -3129,7 +3148,8 @@ class Array[unchecked out Elem] < Object # # [0, 1, 2, 3].rotate!(-1) # => [3, 0, 1, 2] # - # If `count` is small (far from zero), uses `count % array.size` as the count: + # If `count` is small (far from zero), uses count % array.size as + # the count: # # [0, 1, 2, 3].rotate!(-21) # => [3, 0, 1, 2] # @@ -3172,8 +3192,8 @@ class Array[unchecked out Elem] < Object # a = [1, 1, 1, 2, 2, 3] # a.sample(a.size) # => [1, 1, 3, 2, 1, 2] # - # Returns no more than `a.size` elements (because no new duplicates are - # introduced): + # Returns no more than a.size elements (because no new duplicates + # are introduced): # # a.sample(50) # => [6, 4, 1, 8, 5, 9, 0, 2, 3, 7] # @@ -3375,42 +3395,45 @@ class Array[unchecked out Elem] < Object # a[0, 2] # => [:foo, "bar"] # a[1, 2] # => ["bar", 2] # - # If `start + length` is greater than `self.length`, returns all elements from - # offset `start` to the end: + # If start + length is greater than self.length, + # returns all elements from offset `start` to the end: # # a = [:foo, 'bar', 2] # a[0, 4] # => [:foo, "bar", 2] # a[1, 3] # => ["bar", 2] # a[2, 2] # => [2] # - # If `start == self.size` and `length >= 0`, returns a new empty array. + # If start == self.size and length >= 0, returns a new + # empty array. # # If `length` is negative, returns `nil`. # - # When a single Range argument `range` is given, treats `range.min` as `start` - # above and `range.size` as `length` above: + # When a single Range argument `range` is given, treats range.min + # as `start` above and range.size as `length` above: # # a = [:foo, 'bar', 2] # a[0..1] # => [:foo, "bar"] # a[1..2] # => ["bar", 2] # - # Special case: If `range.start == a.size`, returns a new empty array. + # Special case: If range.start == a.size, returns a new empty + # array. # - # If `range.end` is negative, calculates the end index from the end: + # If range.end is negative, calculates the end index from the end: # # a = [:foo, 'bar', 2] # a[0..-1] # => [:foo, "bar", 2] # a[0..-2] # => [:foo, "bar"] # a[0..-3] # => [:foo] # - # If `range.start` is negative, calculates the start index from the end: + # If range.start is negative, calculates the start index from the + # end: # # a = [:foo, 'bar', 2] # a[-1..2] # => [2] # a[-2..2] # => ["bar", 2] # a[-3..2] # => [:foo, "bar", 2] # - # If `range.start` is larger than the array size, returns `nil`. + # If range.start is larger than the array size, returns `nil`. # # a = [:foo, 'bar', 2] # a[4..1] # => nil @@ -3492,42 +3515,43 @@ class Array[unchecked out Elem] < Object # a.slice!(5, 1) # => nil # a.slice!(-5, 1) # => nil # - # If `start + length` exceeds the array size, removes and returns all elements - # from offset `start` to the end: + # If start + length exceeds the array size, removes and returns all + # elements from offset `start` to the end: # # a = ['a', 'b', 'c', 'd'] # a.slice!(2, 50) # => ["c", "d"] # a # => ["a", "b"] # - # If `start == a.size` and `length` is non-negative, returns a new empty array. + # If start == a.size and `length` is non-negative, returns a new + # empty array. # # If `length` is negative, returns `nil`. # - # With Range argument `range` given, treats `range.min` as `start` (as above) - # and `range.size` as `length` (as above): + # With Range argument `range` given, treats range.min as `start` + # (as above) and range.size as `length` (as above): # # a = ['a', 'b', 'c', 'd'] # a.slice!(1..2) # => ["b", "c"] # a # => ["a", "d"] # - # If `range.start == a.size`, returns a new empty array: + # If range.start == a.size, returns a new empty array: # # a = ['a', 'b', 'c', 'd'] # a.slice!(4..5) # => [] # - # If `range.start` is larger than the array size, returns `nil`: + # If range.start is larger than the array size, returns `nil`: # # a = ['a', 'b', 'c', 'd'] # a.slice!(5..6) # => nil # - # If `range.start` is negative, calculates the start index by counting backwards - # from the end of `self`: + # If range.start is negative, calculates the start index by + # counting backwards from the end of `self`: # # a = ['a', 'b', 'c', 'd'] # a.slice!(-2..2) # => ["c"] # - # If `range.end` is negative, calculates the end index by counting backwards - # from the end of `self`: + # If range.end is negative, calculates the end index by counting + # backwards from the end of `self`: # # a = ['a', 'b', 'c', 'd'] # a.slice!(0..-2) # => ["a", "b", "c"] @@ -3545,7 +3569,8 @@ class Array[unchecked out Elem] < Object # --> # Returns a new array containing the elements of `self`, sorted. # - # With no block given, compares elements using operator `#<=>` (see Object#<=>): + # With no block given, compares elements using operator #<=> (see + # Object#<=>): # # [0, 2, 3, 1].sort # => [0, 1, 2, 3] # @@ -3621,7 +3646,8 @@ class Array[unchecked out Elem] < Object # array.each {|element| sum += element } # sum # - # For example, `[e0, e1, e2].sum` returns `init + e0 + e1 + e2`. + # For example, [e0, e1, e2].sum returns init + e0 + e1 + + # e2. # # Examples: # @@ -3632,7 +3658,7 @@ class Array[unchecked out Elem] < Object # # => [2, 3, :foo, :bar, "foo", "bar"] # # The `init` value and elements need not be numeric, but must all be - # `+`-compatible: + # +-compatible: # # # Raises TypeError: Array can't be coerced into Integer. # [[:foo, :bar], ['foo', 'bar']].sum(2) @@ -3747,8 +3773,8 @@ class Array[unchecked out Elem] < Object | [T, S] () { (Elem) -> [ T, S ] } -> Hash[T, S] # - # Returns the new string formed by calling method `#inspect` on each array - # element: + # Returns the new string formed by calling method #inspect on each + # array element: # # a = [:foo, 'bar', 2] # a.inspect # => "[:foo, \"bar\", 2]" @@ -3778,7 +3804,7 @@ class Array[unchecked out Elem] < Object # - union(*other_arrays) -> new_array # --> # Returns a new array that is the union of the elements of `self` and all given - # arrays `other_arrays`; items are compared using `eql?`: + # arrays `other_arrays`; items are compared using eql?: # # [0, 1, 2, 3].union([4, 5], [6, 7]) # => [0, 1, 2, 3, 4, 5, 6, 7] # @@ -3805,15 +3831,15 @@ class Array[unchecked out Elem] < Object # duplicates, the first occurrence always being retained. # # With no block given, identifies and omits duplicate elements using method - # `eql?` to compare elements: + # eql? to compare elements: # # a = [0, 0, 1, 1, 2, 2] # a.uniq # => [0, 1, 2] # # With a block given, calls the block for each element; identifies and omits - # "duplicate" elements using method `eql?` to compare *block return values*; - # that is, an element is a duplicate if its block return value is the same as - # that of a previous element: + # "duplicate" elements using method eql? to compare *block return + # values*; that is, an element is a duplicate if its block return value is the + # same as that of a previous element: # # a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb'] # a.uniq {|element| element.size } # => ["a", "aa", "aaa"] @@ -3831,17 +3857,17 @@ class Array[unchecked out Elem] < Object # Removes duplicate elements from `self`, the first occurrence always being # retained; returns `self` if any elements removed, `nil` otherwise. # - # With no block given, identifies and removes elements using method `eql?` to - # compare elements: + # With no block given, identifies and removes elements using method + # eql? to compare elements: # # a = [0, 0, 1, 1, 2, 2] # a.uniq! # => [0, 1, 2] # a.uniq! # => nil # # With a block given, calls the block for each element; identifies and omits - # "duplicate" elements using method `eql?` to compare *block return values*; - # that is, an element is a duplicate if its block return value is the same as - # that of a previous element: + # "duplicate" elements using method eql? to compare *block return + # values*; that is, an element is a duplicate if its block return value is the + # same as that of a previous element: # # a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb'] # a.uniq! {|element| element.size } # => ["a", "aa", "aaa"] @@ -3907,13 +3933,13 @@ class Array[unchecked out Elem] < Object # For each numeric specifier `index`, includes an element: # # * For each non-negative numeric specifier `index` that is in-range (less - # than `self.size`), includes the element at offset `index`: + # than self.size), includes the element at offset `index`: # # a.values_at(0, 2) # => ["a", "c"] # a.values_at(0.1, 2.9) # => ["a", "c"] # # * For each negative numeric `index` that is in-range (greater than or equal - # to `- self.size`), counts backwards from the end of `self`: + # to - self.size), counts backwards from the end of `self`: # # a.values_at(-1, -4) # => ["d", "a"] # @@ -3925,37 +3951,41 @@ class Array[unchecked out Elem] < Object # # a.values_at(4, -5) # => [nil, nil] # - # For each Range specifier `range`, includes elements according to `range.begin` - # and `range.end`: + # For each Range specifier `range`, includes elements according to + # range.begin and range.end: # - # * If both `range.begin` and `range.end` are non-negative and in-range (less - # than `self.size`), includes elements from index `range.begin` through - # `range.end - 1` (if `range.exclude_end?`), or through `range.end` - # (otherwise): + # * If both range.begin and range.end are + # non-negative and in-range (less than self.size), includes + # elements from index range.begin through range.end - + # 1 (if range.exclude_end?), or through + # range.end (otherwise): # # a.values_at(1..2) # => ["b", "c"] # a.values_at(1...2) # => ["b"] # - # * If `range.begin` is negative and in-range (greater than or equal to `- - # self.size`), counts backwards from the end of `self`: + # * If range.begin is negative and in-range (greater than or + # equal to - self.size), counts backwards from the end of + # `self`: # # a.values_at(-2..3) # => ["c", "d"] # - # * If `range.begin` is negative and out-of-range, raises an exception: + # * If range.begin is negative and out-of-range, raises an + # exception: # # a.values_at(-5..3) # Raises RangeError. # - # * If `range.end` is positive and out-of-range, extends the returned array - # with `nil` elements: + # * If range.end is positive and out-of-range, extends the + # returned array with `nil` elements: # # a.values_at(1..5) # => ["b", "c", "d", nil, nil] # - # * If `range.end` is negative and in-range, counts backwards from the end of - # `self`: + # * If range.end is negative and in-range, counts backwards from + # the end of `self`: # # a.values_at(1..-2) # => ["b", "c"] # - # * If `range.end` is negative and out-of-range, returns an empty array: + # * If range.end is negative and out-of-range, returns an empty + # array: # # a.values_at(1..-5) # => [] # @@ -3984,8 +4014,8 @@ class Array[unchecked out Elem] < Object # # Returned: # - # * The outer array is of size `self.size`. - # * Each sub-array is of size `other_arrays.size + 1`. + # * The outer array is of size self.size. + # * Each sub-array is of size other_arrays.size + 1. # * The *nth* sub-array contains (in order): # # * The *nth* element of `self`. @@ -4058,8 +4088,8 @@ class Array[unchecked out Elem] < Object # [:c3, :b3, :a3]] # # For an **object** in **other_arrays** that is not actually an array, forms the - # "other array" as `object.to_ary`, if defined, or as `object.each.to_a` - # otherwise. + # "other array" as object.to_ary, if defined, or as + # object.each.to_a otherwise. # # Related: see [Methods for Converting](rdoc-ref:Array@Methods+for+Converting). # @@ -4073,7 +4103,7 @@ class Array[unchecked out Elem] < Object # - self | other_array -> new_array # --> # Returns the union of `self` and `other_array`; duplicates are removed; order - # is preserved; items are compared using `eql?`: + # is preserved; items are compared using eql?: # # [0, 1] | [2, 3] # => [0, 1, 2, 3] # [0, 1, 1] | [2, 2, 3] # => [0, 1, 2, 3] diff --git a/core/basic_object.rbs b/core/basic_object.rbs index ce7deb01f..07f674206 100644 --- a/core/basic_object.rbs +++ b/core/basic_object.rbs @@ -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 (::String, not +# `String`). # # A variety of strategies can be used to provide useful portions of the Standard # Library in subclasses of `BasicObject`: @@ -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, a.equal?(b) if and + # only if `a` is the same object as `b`): # # obj = "a" # other = obj.dup @@ -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, a.equal?(b) if and + # only if `a` is the same object as `b`): # # obj = "a" # other = obj.dup @@ -315,7 +316,7 @@ class BasicObject # def Chatty.three() end # end # - # *produces:* + # produces: # # Adding singleton_method_added # Adding one @@ -343,7 +344,7 @@ class BasicObject # end # end # - # *produces:* + # produces: # # Removing three # Removing one @@ -367,7 +368,7 @@ class BasicObject # end # end # - # *produces:* + # produces: # # Undefining one # diff --git a/core/class.rbs b/core/class.rbs index abfdc2164..091ffb4d4 100644 --- a/core/class.rbs +++ b/core/class.rbs @@ -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 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: # # class Class # alias old_new new @@ -26,7 +27,7 @@ # # n = Name.new # -# *produces:* +# produces: # # Creating a new Name # @@ -144,7 +145,7 @@ class Class < Module # class Baz < Bar # end # - # *produces:* + # produces: # # New subclass: Bar # New subclass: Baz @@ -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 .new. # def new: () -> untyped diff --git a/core/comparable.rbs b/core/comparable.rbs index 802be5b23..0cdc83de2 100644 --- a/core/comparable.rbs +++ b/core/comparable.rbs @@ -1,12 +1,13 @@ # # 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 <=> 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 StringSorter # include Comparable @@ -38,7 +39,8 @@ # # ## What's Here # -# Module Comparable provides these methods, all of which use method `#<=>`: +# Module Comparable provides these methods, all of which use method +# #<=>: # # * #<: Returns whether `self` is less than the given object. # * #<=: Returns whether `self` is less than or equal to the given object. @@ -46,10 +48,11 @@ # * #>: 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 +# (min..max), returns: # -# * `min` if `(self <=> min) < 0`. -# * `max` if `(self <=> max) > 0`. +# * `min` if (self <=> min) < 0. +# * `max` if (self <=> max) > 0. # * `self` otherwise. # module Comparable : _WithSpaceshipOperator @@ -57,8 +60,8 @@ 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 (self <=> + # other) < 0: # # 'foo' < 'foo' # => false # 'foo' < 'food' # => true @@ -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`: + # (self <=> other) <= 0: # # 'foo' <= 'foo' # => true # 'foo' <= 'food' # => true @@ -82,8 +85,9 @@ 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 <=> method, + # returning true if it returns 0. Also returns true if *obj* and *other* are the + # same object. # def ==: (untyped other) -> bool @@ -91,8 +95,8 @@ 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 a value greater than 0. + # Compares two objects based on the receiver's <=> method, + # returning true if it returns a value greater than 0. # def >: (untyped other) -> bool @@ -100,8 +104,8 @@ 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 a value greater than or equal to 0. + # Compares two objects based on the receiver's <=> method, + # returning true if it returns a value greater than or equal to 0. # def >=: (untyped other) -> bool @@ -109,8 +113,8 @@ module Comparable : _WithSpaceshipOperator # 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* <=> *min* is less than zero or if *obj* + # <=> *max* is greater than zero, `true` otherwise. # # 3.between?(1, 5) #=> true # 6.between?(1, 5) #=> false @@ -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 (min, max) form, returns *min* if *obj* <=> *min* + # is less than zero, *max* if *obj* <=> *max* is greater than zero, + # and *obj* otherwise. # # 12.clamp(0, 100) #=> 12 # 523.clamp(0, 100) #=> 100 @@ -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 (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. # # 12.clamp(0..100) #=> 12 # 523.clamp(0..100) #=> 100 @@ -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 range.begin is `nil`, it is considered smaller than *obj*, and if + # range.end 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 range.end is excluded and not `nil`, an exception is raised. # # 100.clamp(0...100) # ArgumentError # diff --git a/core/complex.rbs b/core/complex.rbs index c1b67803d..09d344cd7 100644 --- a/core/complex.rbs +++ b/core/complex.rbs @@ -79,17 +79,19 @@ # * #arg (and its aliases #angle and #phase): Returns the argument (angle) for # `self` in radians. # * #denominator: Returns the denominator of `self`. -# * #finite?: Returns whether both `self.real` and `self.image` are finite. +# * #finite?: Returns whether both self.real and +# self.image are finite. # * #hash: Returns the integer hash value for `self`. # * #imag (and its alias #imaginary): Returns the imaginary value for `self`. -# * #infinite?: Returns whether `self.real` or `self.image` is infinite. +# * #infinite?: Returns whether self.real or +# self.image is infinite. # * #numerator: Returns the numerator of `self`. -# * #polar: Returns the array `[self.abs, self.arg]`. +# * #polar: Returns the array [self.abs, self.arg]. # * #inspect: Returns a string representation of `self`. # * #real: Returns the real value for `self`. # * #real?: Returns `false`; for compatibility with Numeric#real?. -# * #rect (and its alias #rectangular): Returns the array `[self.real, -# self.imag]`. +# * #rect (and its alias #rectangular): Returns the array [self.real, +# self.imag]. # # ### Comparing # @@ -100,12 +102,15 @@ # ### Converting # # * #rationalize: Returns a Rational object whose value is exactly or -# approximately equivalent to that of `self.real`. +# approximately equivalent to that of self.real. # * #to_c: Returns `self`. # * #to_d: Returns the value as a BigDecimal object. -# * #to_f: Returns the value of `self.real` as a Float, if possible. -# * #to_i: Returns the value of `self.real` as an Integer, if possible. -# * #to_r: Returns the value of `self.real` as a Rational, if possible. +# * #to_f: Returns the value of self.real as a Float, if +# possible. +# * #to_i: Returns the value of self.real as an Integer, if +# possible. +# * #to_r: Returns the value of self.real as a Rational, if +# possible. # * #to_s: Returns a string representation of `self`. # # ### Performing Complex Arithmetic @@ -118,7 +123,8 @@ # * #/: Returns the quotient of `self` and the given numeric. # * #abs2: Returns square of the absolute value (magnitude) for `self`. # * #conj (and its alias #conjugate): Returns the conjugate of `self`. -# * #fdiv: Returns `Complex.rect(self.real/numeric, self.imag/numeric)`. +# * #fdiv: Returns Complex.rect(self.real/numeric, +# self.imag/numeric). # # ### Working with JSON # @@ -283,10 +289,11 @@ class Complex < Numeric # # Returns: # - # * `self.real <=> other.real` if both of the following are true: + # * self.real <=> other.real if both of the following are true: # - # * `self.imag == 0`. - # * `other.imag == 0` (always true if `other` is numeric but not complex). + # * self.imag == 0. + # * other.imag == 0 (always true if `other` is numeric but + # not complex). # # * `nil` otherwise. # @@ -308,7 +315,8 @@ class Complex < Numeric # rdoc-file=complex.c # - complex == object -> true or false # --> - # Returns `true` if `self.real == object.real` and `self.imag == object.imag`: + # Returns `true` if self.real == object.real and self.imag == + # object.imag: # # Complex.rect(2, 3) == Complex.rect(2.0, 3.0) # => true # @@ -388,7 +396,8 @@ class Complex < Numeric def coerce: (Numeric) -> [ Complex, Complex ] # - # Returns the conjugate of `self`, `Complex.rect(self.imag, self.real)`: + # Returns the conjugate of `self`, Complex.rect(self.imag, + # self.real): # # Complex.rect(1, 2).conj # => (1-2i) # @@ -398,7 +407,8 @@ class Complex < Numeric # rdoc-file=complex.c # - conj -> complex # --> - # Returns the conjugate of `self`, `Complex.rect(self.imag, self.real)`: + # Returns the conjugate of `self`, Complex.rect(self.imag, + # self.real): # # Complex.rect(1, 2).conj # => (1-2i) # @@ -410,11 +420,11 @@ class Complex < Numeric # --> # Returns the denominator of `self`, which is the [least common # multiple](https://en.wikipedia.org/wiki/Least_common_multiple) of - # `self.real.denominator` and `self.imag.denominator`: + # self.real.denominator and self.imag.denominator: # # Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6 # - # Note that `n.denominator` of a non-rational numeric is `1`. + # Note that n.denominator of a non-rational numeric is `1`. # # Related: Complex#numerator. # @@ -428,7 +438,7 @@ class Complex < Numeric # rdoc-file=complex.c # - fdiv(numeric) -> new_complex # --> - # Returns `Complex.rect(self.real/numeric, self.imag/numeric)`: + # Returns Complex.rect(self.real/numeric, self.imag/numeric): # # Complex.rect(11, 22).fdiv(3) # => (3.6666666666666665+7.333333333333333i) # @@ -438,8 +448,8 @@ class Complex < Numeric # rdoc-file=complex.c # - finite? -> true or false # --> - # Returns `true` if both `self.real.finite?` and `self.imag.finite?` are true, - # `false` otherwise: + # Returns `true` if both self.real.finite? and + # self.imag.finite? are true, `false` otherwise: # # Complex.rect(1, 1).finite? # => true # Complex.rect(Float::INFINITY, 0).finite? # => false @@ -467,7 +477,7 @@ class Complex < Numeric # rdoc-file=numeric.c # - i -> complex # --> - # Returns `Complex(0, self)`: + # Returns Complex(0, self): # # 2.i # => (0+2i) # -2.i # => (0-2i) @@ -513,8 +523,8 @@ class Complex < Numeric # rdoc-file=complex.c # - infinite? -> 1 or nil # --> - # Returns `1` if either `self.real.infinite?` or `self.imag.infinite?` is true, - # `nil` otherwise: + # Returns `1` if either self.real.infinite? or + # self.imag.infinite? is true, `nil` otherwise: # # Complex.rect(Float::INFINITY, 0).infinite? # => 1 # Complex.rect(1, 1).infinite? # => nil @@ -570,7 +580,7 @@ class Complex < Numeric # In this example, the lowest common denominator of the two parts is 12; the two # converted parts may be thought of as Rational(8, 12) and Rational(9, 12), # whose numerators, respectively, are 8 and 9; so the returned value of - # `c.numerator` is `Complex.rect(8, 9)`. + # c.numerator is Complex.rect(8, 9). # # Related: Complex#denominator. # @@ -594,7 +604,7 @@ class Complex < Numeric # rdoc-file=complex.c # - polar -> array # --> - # Returns the array `[self.abs, self.arg]`: + # Returns the array [self.abs, self.arg]: # # Complex.polar(1, 2).polar # => [1.0, 2.0] # @@ -629,17 +639,18 @@ class Complex < Numeric # - rationalize(epsilon = nil) -> rational # --> # Returns a Rational object whose value is exactly or approximately equivalent - # to that of `self.real`. + # to that of self.real. # # With no argument `epsilon` given, returns a Rational object whose value is - # exactly equal to that of `self.real.rationalize`: + # exactly equal to that of self.real.rationalize: # # Complex.rect(1, 0).rationalize # => (1/1) # Complex.rect(1, Rational(0, 1)).rationalize # => (1/1) # Complex.rect(3.14159, 0).rationalize # => (314159/100000) # # With argument `epsilon` given, returns a Rational object whose value is - # exactly or approximately equal to that of `self.real` to the given precision: + # exactly or approximately equal to that of self.real to the given + # precision: # # Complex.rect(3.14159, 0).rationalize(0.1) # => (16/5) # Complex.rect(3.14159, 0).rationalize(0.01) # => (22/7) @@ -700,7 +711,7 @@ class Complex < Numeric # rdoc-file=complex.c # - rect -> array # --> - # Returns the array `[self.real, self.imag]`: + # Returns the array [self.real, self.imag]: # # Complex.rect(1, 2).rect # => [1, 2] # @@ -734,13 +745,13 @@ class Complex < Numeric # rdoc-file=complex.c # - to_f -> float # --> - # Returns the value of `self.real` as a Float, if possible: + # Returns the value of self.real as a Float, if possible: # # Complex.rect(1, 0).to_f # => 1.0 # Complex.rect(1, Rational(0, 1)).to_f # => 1.0 # - # Raises RangeError if `self.imag` is not exactly zero (either `Integer(0)` or - # `Rational(0, _n_)`). + # Raises RangeError if self.imag is not exactly zero (either + # Integer(0) or Rational(0, _n_)). # def to_f: () -> Float @@ -748,13 +759,13 @@ class Complex < Numeric # rdoc-file=complex.c # - to_i -> integer # --> - # Returns the value of `self.real` as an Integer, if possible: + # Returns the value of self.real as an Integer, if possible: # # Complex.rect(1, 0).to_i # => 1 # Complex.rect(1, Rational(0, 1)).to_i # => 1 # - # Raises RangeError if `self.imag` is not exactly zero (either `Integer(0)` or - # `Rational(0, _n_)`). + # Raises RangeError if self.imag is not exactly zero (either + # Integer(0) or Rational(0, _n_)). # def to_i: () -> Integer @@ -762,14 +773,15 @@ class Complex < Numeric # rdoc-file=complex.c # - to_r -> rational # --> - # Returns the value of `self.real` as a Rational, if possible: + # Returns the value of self.real as a Rational, if possible: # # Complex.rect(1, 0).to_r # => (1/1) # Complex.rect(1, Rational(0, 1)).to_r # => (1/1) # Complex.rect(1, 0.0).to_r # => (1/1) # - # Raises RangeError if `self.imag` is not exactly zero (either `Integer(0)` or - # `Rational(0, _n_)`) and `self.imag.to_r` is not exactly zero. + # Raises RangeError if self.imag is not exactly zero (either + # Integer(0) or Rational(0, _n_)) and + # self.imag.to_r is not exactly zero. # # Related: Complex#rationalize. # @@ -793,7 +805,7 @@ class Complex < Numeric end # -# Equivalent to `Complex.rect(0, 1)`: +# Equivalent to Complex.rect(0, 1): # # Complex::I # => (0+1i) # diff --git a/core/dir.rbs b/core/dir.rbs index 8c5ff651a..259ae1dff 100644 --- a/core/dir.rbs +++ b/core/dir.rbs @@ -116,10 +116,12 @@ # # * ::[]: Same as ::glob without the ability to pass flags. # * ::children: Returns an array of names of the children (both files and -# directories) of the given directory, but not including `.` or `..`. +# directories) of the given directory, but not including . or +# ... # * ::empty?: Returns whether the given path is an empty directory. # * ::entries: Returns an array of names of the children (both files and -# directories) of the given directory, including `.` and `..`. +# directories) of the given directory, including . and +# ... # * ::exist?: Returns whether the given path is a directory. # * ::getwd (aliased as #pwd): Returns the path to the current working # directory. @@ -128,7 +130,8 @@ # * ::home: Returns the home directory path for a given user or the current # user. # * #children: Returns an array of names of the children (both files and -# directories) of `self`, but not including `.` or `..`. +# directories) of `self`, but not including . or +# ... # * #fileno: Returns the integer file descriptor for `self`. # * #path (aliased as #to_path): Returns the path used to create `self`. # * #tell (aliased as #pos): Returns the integer position in the directory @@ -137,13 +140,13 @@ # ### Iterating # # * ::each_child: Calls the given block with each entry in the given -# directory, but not including `.` or `..`. +# directory, but not including . or ... # * ::foreach: Calls the given block with each entry in the given directory, -# including `.` and `..`. -# * #each: Calls the given block with each entry in `self`, including `.` and -# `..`. +# including . and ... +# * #each: Calls the given block with each entry in `self`, including +# . and ... # * #each_child: Calls the given block with each entry in `self`, but not -# including `.` or `..`. +# including . or ... # # ### Other # @@ -255,7 +258,8 @@ class Dir # - Dir.children(dirpath, encoding: 'UTF-8') -> array # --> # Returns an array of the entry names in the directory at `dirpath` except for - # `'.'` and `'..'`; sets the given encoding onto each returned entry name: + # '.' and '..'; sets the given encoding onto each + # returned entry name: # # Dir.children('/example') # => ["config.h", "lib", "main.rb"] # Dir.children('/example').first.encoding @@ -274,8 +278,9 @@ class Dir # - Dir.chroot(dirpath) -> 0 # --> # Changes the root directory of the calling process to that specified in - # `dirpath`. The new root directory is used for pathnames beginning with `'/'`. - # The root directory is inherited by all children of the calling process. + # `dirpath`. The new root directory is used for pathnames beginning with + # '/'. The root directory is inherited by all children of the + # calling process. # # Only a privileged process may call `chroot`. # @@ -300,7 +305,8 @@ class Dir # - Dir.each_child(dirpath) {|entry_name| ... } -> nil # - Dir.each_child(dirpath, encoding: 'UTF-8') {|entry_name| ... } -> nil # --> - # Like Dir.foreach, except that entries `'.'` and `'..'` are not included. + # Like Dir.foreach, except that entries '.' and '..' + # are not included. # def self.each_child: (path dirname, ?encoding: encoding?) -> Enumerator[String, nil] | (path dirname, ?encoding: encoding?) { (String filename) -> void } -> nil @@ -487,8 +493,8 @@ class Dir # # Notes for the following examples: # - # * `'*'` is the pattern that matches any entry name except those that begin - # with `'.'`. + # * '*' is the pattern that matches any entry name except those + # that begin with '.'. # * We use method Array#take to shorten returned arrays that otherwise would # be very large. # @@ -513,8 +519,8 @@ class Dir # # If optional keyword argument `base` is given, its value specifies the base # directory. Each pattern string specifies entries relative to the base - # directory; the default is `'.'`. The base directory is not prepended to the - # entry names in the result: + # directory; the default is '.'. The base directory is not + # prepended to the entry names in the result: # # Dir.glob(pattern, base: 'lib').take(5) # # => ["abbrev.gemspec", "abbrev.rb", "base64.gemspec", "base64.rb", "benchmark.gemspec"] @@ -531,60 +537,64 @@ class Dir # Each pattern string is expanded according to certain metacharacters; examples # below use the [Ruby file tree](rdoc-ref:Dir@About+the+Examples): # - # * `'*'`: Matches any substring in an entry name, similar in meaning to - # regexp `/.*/mx`; may be restricted by other values in the pattern strings: + # * '*': Matches any substring in an entry name, similar in + # meaning to regexp /.*/mx; may be restricted by other values + # in the pattern strings: # - # * `'*'` matches all entry names: + # * '*' matches all entry names: # # Dir.glob('*').take(3) # => ["BSDL", "CONTRIBUTING.md", "COPYING"] # - # * `'c*'` matches entry names beginning with `'c'`: + # * 'c*' matches entry names beginning with 'c': # # Dir.glob('c*').take(3) # => ["CONTRIBUTING.md", "COPYING", "COPYING.ja"] # - # * `'*c'` matches entry names ending with `'c'`: + # * '*c' matches entry names ending with 'c': # # Dir.glob('*c').take(3) # => ["addr2line.c", "array.c", "ast.c"] # - # * `'*c*'` matches entry names that contain `'c'`, even at the beginning - # or end: + # * '*c*' matches entry names that contain 'c', + # even at the beginning or end: # # Dir.glob('*c*').take(3) # => ["CONTRIBUTING.md", "COPYING", "COPYING.ja"] # # Does not match Unix-like hidden entry names ("dot files"). To include # those in the matched entry names, use flag IO::FNM_DOTMATCH or something - # like `'{*,.*}'`. + # like '{*,.*}'. # - # * `'**'`: Matches entry names recursively if followed by the slash - # character `'/'`: + # * '**': Matches entry names recursively if followed by the + # slash character '/': # # Dir.glob('**/').take(3) # => ["basictest/", "benchmark/", "benchmark/gc/"] # # If the string pattern contains other characters or is not followed by a - # slash character, it is equivalent to `'*'`. + # slash character, it is equivalent to '*'. # - # * `'?'` Matches any single character; similar in meaning to regexp `/./`: + # * '?' Matches any single character; similar in meaning to + # regexp /./: # # Dir.glob('io.?') # => ["io.c"] # - # * `'[_set_]'`: Matches any one character in the string *set*; behaves like a - # [Regexp character class](rdoc-ref:Regexp@Character+Classes), including set - # negation (`'[^a-z]'`): + # * '[_set_]': Matches any one character in the string *set*; + # behaves like a [Regexp character + # class](rdoc-ref:Regexp@Character+Classes), including set negation + # ('[^a-z]'): # # Dir.glob('*.[a-z][a-z]').take(3) # # => ["CONTRIBUTING.md", "COPYING.ja", "KNOWNBUGS.rb"] # - # * `'{_abc_,_xyz_}'`: Matches either string *abc* or string *xyz*; behaves - # like [Regexp alternation](rdoc-ref:Regexp@Alternation): + # * '{_abc_,_xyz_}': Matches either string *abc* or string *xyz*; + # behaves like [Regexp alternation](rdoc-ref:Regexp@Alternation): # # Dir.glob('{LEGAL,BSDL}') # => ["LEGAL", "BSDL"] # # More than two alternatives may be given. # - # * `\`: Escapes the following metacharacter. + # * \: Escapes the following metacharacter. # # Note that on Windows, the backslash character may not be used in a string - # pattern: `Dir['c:\\foo*']` will not work, use `Dir['c:/foo*']` instead. + # pattern: Dir['c:\foo*'] will not work, use + # Dir['c:/foo*'] instead. # # More examples (using the [simple file tree](rdoc-ref:Dir@About+the+Examples)): # @@ -623,26 +633,26 @@ class Dir # # The flags for this method (other constants in File::Constants do not apply): # - # * File::FNM_DOTMATCH: specifies that entry names beginning with `'.'` should - # be considered for matching: + # * File::FNM_DOTMATCH: specifies that entry names beginning with + # '.' should be considered for matching: # # Dir.glob('*').take(5) # # => ["BSDL", "CONTRIBUTING.md", "COPYING", "COPYING.ja", "GPL"] # Dir.glob('*', flags: File::FNM_DOTMATCH).take(5) # # => [".", ".appveyor.yml", ".cirrus.yml", ".dir-locals.el", ".document"] # - # * File::FNM_EXTGLOB: enables the pattern extension `'{_a_,_b_}'`, which - # matches pattern *a* and pattern *b*; behaves like a [regexp - # union](rdoc-ref:Regexp.union) (e.g., `'(?:_a_|_b_)'`): + # * File::FNM_EXTGLOB: enables the pattern extension '{_a_,_b_}', + # which matches pattern *a* and pattern *b*; behaves like a [regexp + # union](rdoc-ref:Regexp.union) (e.g., '(?:_a_|_b_)'): # # pattern = '{LEGAL,BSDL}' # Dir.glob(pattern) # => ["LEGAL", "BSDL"] # # * File::FNM_NOESCAPE: specifies that escaping with the backslash character - # `'\'` is disabled; the character is not an escape character. + # '\' is disabled; the character is not an escape character. # - # * File::FNM_PATHNAME: specifies that metacharacters `'*'` and `'?'` do not - # match directory separators. + # * File::FNM_PATHNAME: specifies that metacharacters '*' and + # '?' do not match directory separators. # # * File::FNM_SHORTNAME: specifies that patterns may match short names if they # exist; Windows only. @@ -774,7 +784,8 @@ class Dir # rdoc-file=dir.c # - children -> array # --> - # Returns an array of the entry names in `self` except for `'.'` and `'..'`: + # Returns an array of the entry names in `self` except for '.' and + # '..': # # dir = Dir.new('/example') # dir.children # => ["config.h", "lib", "main.rb"] @@ -821,7 +832,8 @@ class Dir # rdoc-file=dir.c # - each_child {|entry_name| ... } -> self # --> - # Calls the block with each entry name in `self` except `'.'` and `'..'`: + # Calls the block with each entry name in `self` except '.' and + # '..': # # dir = Dir.new('/example') # dir.each_child {|entry_name| p entry_name } diff --git a/core/encoding.rbs b/core/encoding.rbs index 1960bcc0d..0654474fa 100644 --- a/core/encoding.rbs +++ b/core/encoding.rbs @@ -127,7 +127,7 @@ class Encoding # Sets default external encoding. You should not set Encoding::default_external # in ruby code as strings created before changing the value may have a different # encoding from strings created after the value was changed., instead you should - # use `ruby -E` to invoke ruby with the correct default_external. + # use ruby -E to invoke ruby with the correct default_external. # # See Encoding::default_external for information on how the default external # encoding is used. @@ -172,8 +172,8 @@ class Encoding # Sets default internal encoding or removes default internal encoding when # passed nil. You should not set Encoding::default_internal in ruby code as # strings created before changing the value may have a different encoding from - # strings created after the change. Instead you should use `ruby -E` to invoke - # ruby with the correct default_internal. + # strings created after the change. Instead you should use ruby -E + # to invoke ruby with the correct default_internal. # # See Encoding::default_internal for information on how the default internal # encoding is used. @@ -207,8 +207,8 @@ class Encoding # # # An ArgumentError is raised when no encoding with *name*. Only - # `Encoding.find("internal")` however returns nil when no encoding named - # "internal", in other words, when Ruby has no default internal encoding. + # Encoding.find("internal") however returns nil when no encoding + # named "internal", in other words, when Ruby has no default internal encoding. # def self.find: (encoding enc) -> Encoding? diff --git a/core/enumerable.rbs b/core/enumerable.rbs index f3ed49cca..4543e0959 100644 --- a/core/enumerable.rbs +++ b/core/enumerable.rbs @@ -16,8 +16,8 @@ # These methods return information about the Enumerable other than the elements # themselves: # -# * #member? (aliased as #include?): Returns `true` if `self == object`, -# `false` otherwise. +# * #member? (aliased as #include?): Returns `true` if self == +# object, `false` otherwise. # * #all?: Returns `true` if all elements meet a specified criterion; `false` # otherwise. # * #any?: Returns `true` if any element meets a specified criterion; `false` @@ -35,7 +35,7 @@ # # These methods return entries from the Enumerable, without modifying it: # -# *Leading, trailing, or all elements*: +# Leading, trailing, or all elements: # # * #to_a (aliased as #entries): Returns all elements. # * #first: Returns the first element or leading elements. @@ -47,9 +47,9 @@ # *Minimum and maximum value elements*: # # * #min: Returns the elements whose values are smallest among the elements, -# as determined by `#<=>` or a given block. +# as determined by #<=> or a given block. # * #max: Returns the elements whose values are largest among the elements, as -# determined by `#<=>` or a given block. +# determined by #<=> or a given block. # * #minmax: Returns a 2-element Array containing the smallest and largest # elements. # * #min_by: Returns the smallest element, as determined by the given block. @@ -57,7 +57,7 @@ # * #minmax_by: Returns the smallest and largest elements, as determined by # the given block. # -# *Groups, slices, and partitions*: +# Groups, slices, and partitions: # # * #group_by: Returns a Hash that partitions the elements into groups. # * #partition: Returns elements partitioned into two new Arrays, as @@ -89,7 +89,8 @@ # # These methods return elements in sorted order: # -# * #sort: Returns the elements, sorted by `#<=>` or the given block. +# * #sort: Returns the elements, sorted by #<=> or the given +# block. # * #sort_by: Returns the elements, sorted by the given block. # # ### Methods for Iterating @@ -118,7 +119,7 @@ # returned by a given block. # * #inject (aliased as #reduce): Returns the object formed by combining all # elements. -# * #sum: Returns the sum of the elements, using method `+`. +# * #sum: Returns the sum of the elements, using method +. # * #zip: Combines each element with elements from other enumerables; returns # the n-tuples or calls the block with each. # * #cycle: Calls the block with each element, cycling repeatedly. @@ -131,8 +132,9 @@ # # include Enumerable # -# * Implement method `#each` which must yield successive elements of the -# collection. The method will be called by almost any Enumerable method. +# * Implement method #each which must yield successive elements +# of the collection. The method will be called by almost any Enumerable +# method. # # Example: # @@ -173,13 +175,15 @@ # * CSV::Row # * Set # -# Virtually all methods in Enumerable call method `#each` in the including -# class: +# Virtually all methods in Enumerable call method #each in the +# including class: # -# * `Hash#each` yields the next key-value pair as a 2-element Array. -# * `Struct#each` yields the next name-value pair as a 2-element Array. -# * For the other classes above, `#each` yields the next object from the -# collection. +# * Hash#each yields the next key-value pair as a 2-element +# Array. +# * Struct#each yields the next name-value pair as a 2-element +# Array. +# * For the other classes above, #each yields the next object +# from the collection. # # ## About the Examples # @@ -199,7 +203,7 @@ # ### #size # # Enumerator has a #size method. It uses the size function argument passed to -# `Enumerator.new`. +# Enumerator.new. # # e = Enumerator.new(-> { 3 }) {|y| p y; y.yield :a; y.yield :b; y.yield :c; :z } # p e.size #=> 3 @@ -216,10 +220,10 @@ # (i.e., the number of times Enumerator::Yielder#yield is called). In the above # example, the block calls #yield three times, and the size function, +-> { 3 # }+, returns 3 accordingly. The result of the size function can be an integer, -# `Float::INFINITY`, or `nil`. An integer means the exact number of times #yield -# will be called, as shown above. `Float::INFINITY` indicates an infinite number -# of #yield calls. `nil` means the number of #yield calls is difficult or -# impossible to determine. +# Float::INFINITY, or `nil`. An integer means the exact number of +# times #yield will be called, as shown above. Float::INFINITY +# indicates an infinite number of #yield calls. `nil` means the number of #yield +# calls is difficult or impossible to determine. # # Many iteration methods return an Enumerator object with an appropriate size # function if no block is given. @@ -238,7 +242,7 @@ # element: # # * If the #begin element is an Integer, the #size method returns an Integer -# or `Float::INFINITY`. +# or Float::INFINITY. # * If the #begin element is an object with a #succ method (other than # Integer), #size returns `nil`. (Computing the size would require # repeatedly calling #succ, which may be too slow.) @@ -292,7 +296,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # [].all? # => true # # With argument `pattern` and no block, returns whether for each element - # `element`, `pattern === element`: + # `element`, pattern === element: # # (1..4).all?(Integer) # => true # (1..4).all?(Numeric) # => true @@ -336,7 +340,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # [].any? # => false # # With argument `pattern` and no block, returns whether for any element - # `element`, `pattern === element`: + # `element`, pattern === element: # # [nil, false, 0].any?(Integer) # => true # [nil, false, 0].any?(Numeric) # => true @@ -423,8 +427,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # [0, 1, 2].count # => 3 # {foo: 0, bar: 1, baz: 2}.count # => 3 # - # With argument `object` given, returns the number of elements that are `==` to - # `object`: + # With argument `object` given, returns the number of elements that are + # == to `object`: # # [0, 1, 2, 1].count(1) # => 2 # @@ -562,8 +566,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # - each_with_index(*args) {|element, i| ..... } -> self # - each_with_index(*args) -> enumerator # --> - # Invoke `self.each` with `*args`. With a block given, the block receives each - # element and its index; returns `self`: + # Invoke self.each with *args. With a block given, the + # block receives each element and its index; returns `self`: # # h = {} # (1..4).each_with_index {|element, i| h[element] = i } # => 1..4 @@ -680,7 +684,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # `nil` if no such element is found. # # With argument `object` given, returns the index of the first element that is - # `==` `object`: + # == `object`: # # ['a', 'b', 'c', 'b'].find_index('b') # => 1 # @@ -731,7 +735,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # pattern. # # With no block given, returns an array containing each element for which - # `pattern === element` is `true`: + # pattern === element is `true`: # # a = ['foo', 'bar', 'car', 'moo'] # a.grep(/ar/) # => ["bar", "car"] @@ -754,11 +758,11 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # - grep_v(pattern) -> array # - grep_v(pattern) {|element| ... } -> array # --> - # Returns an array of objects based on elements of `self` that *don't* match the - # given pattern. + # Returns an array of objects based on elements of `self` that don't + # match the given pattern. # # With no block given, returns an array containing each element for which - # `pattern === element` is `false`: + # pattern === element is `false`: # # a = ['foo', 'bar', 'car', 'moo'] # a.grep_v(/ar/) # => ["foo", "moo"] @@ -801,7 +805,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] | () -> ::Enumerator[Elem, ::Array[Elem]] # - # Returns whether for any element `object == element`: + # Returns whether for any element object == element: # # (1..4).include?(2) # => true # (1..4).include?(5) # => false @@ -859,13 +863,13 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # product #=> 24 # # When this runs, the block is first called with `1` (the initial value) and `2` - # (the first element of the array). The block returns `1*2`, so on the next - # iteration the block is called with `2` (the previous result) and `3`. The - # block returns `6`, and is called one last time with `6` and `4`. The result of - # the block, `24` becomes the value returned by `inject`. This code returns the - # product of the elements in the enumerable. + # (the first element of the array). The block returns 1*2, so on + # the next iteration the block is called with `2` (the previous result) and `3`. + # The block returns `6`, and is called one last time with `6` and `4`. The + # result of the block, `24` becomes the value returned by `inject`. This code + # returns the product of the elements in the enumerable. # - # **First Shortcut: Default Initial value** + # First Shortcut: Default Initial value # # In the case of the previous example, the initial value, `1`, wasn't really # necessary: the calculation of the product of a list of numbers is @@ -902,7 +906,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # Note that the last line of the block is just the word `counts`. This ensures # the return value of the block is the result that's being calculated. # - # **Second Shortcut: a Reducer function** + # Second Shortcut: a Reducer function # # A *reducer function* is a function that takes a partial result and the next # value, returning the next partial result. The block that is given to `inject` @@ -947,11 +951,11 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # position = "nnneesw".chars.reduce(Turtle.new, :move) # position #=>> # # - # **Third Shortcut: Reducer With no Initial Value** + # Third Shortcut: Reducer With no Initial Value # # If your reducer returns a value that it can accept as a parameter, then you - # don't have to pass in an initial value. Here `:*` is the name of the *times* - # function: + # don't have to pass in an initial value. Here :* is the name of + # the *times* function: # # product = [ 2, 3, 4 ].inject(:*) # product # => 24 @@ -982,7 +986,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # The ordering of equal elements is indeterminate and may be unstable. # # With no argument and no block, returns the maximum element, using the - # elements' own method `#<=>` for comparison: + # elements' own method #<=> for comparison: # # (1..4).max # => 4 # (-4..-1).max # => -1 @@ -1002,9 +1006,9 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # With a block given, the block determines the maximum elements. The block is # called with two elements `a` and `b`, and must return: # - # * A negative integer if `a < b`. - # * Zero if `a == b`. - # * A positive integer if `a > b`. + # * A negative integer if a < b. + # * Zero if a == b. + # * A positive integer if a > b. # # With a block given and no argument, returns the maximum element as determined # by the block: @@ -1080,7 +1084,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # The ordering of equal elements is indeterminate and may be unstable. # # With no argument and no block, returns the minimum element, using the - # elements' own method `#<=>` for comparison: + # elements' own method #<=> for comparison: # # (1..4).min # => 1 # (-4..-1).min # => -4 @@ -1100,9 +1104,9 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # With a block given, the block determines the minimum elements. The block is # called with two elements `a` and `b`, and must return: # - # * A negative integer if `a < b`. - # * Zero if `a == b`. - # * A positive integer if `a > b`. + # * A negative integer if a < b. + # * Zero if a == b. + # * A positive integer if a > b. # # With a block given and no argument, returns the minimum element as determined # by the block: @@ -1177,7 +1181,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # indeterminate and may be unstable. # # With no argument and no block, returns the minimum and maximum elements, using - # the elements' own method `#<=>` for comparison: + # the elements' own method #<=> for comparison: # # (1..4).minmax # => [1, 4] # (-4..-1).minmax # => [-4, -1] @@ -1240,7 +1244,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # [].none? # => true # # With argument `pattern` and no block, returns whether for no element - # `element`, `pattern === element`: + # `element`, pattern === element: # # [nil, false, 1.1].none?(Integer) # => true # %w[bar baz bat bam].none?(/m/) # => false @@ -1282,7 +1286,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # [].one? # => false # # With argument `pattern` and no block, returns whether for exactly one element - # `element`, `pattern === element`: + # `element`, pattern === element: # # [nil, false, 0].one?(Integer) # => true # [nil, false, 0].one?(Numeric) # => true @@ -1393,7 +1397,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # Returns an array containing the sorted elements of `self`. The ordering of # equal elements is indeterminate and may be unstable. # - # With no block given, the sort compares using the elements' own method `#<=>`: + # With no block given, the sort compares using the elements' own method + # #<=>: # # %w[b c a d].sort # => ["a", "b", "c", "d"] # {foo: 0, bar: 1, baz: 2}.sort # => [[:bar, 1], [:baz, 2], [:foo, 0]] @@ -1401,9 +1406,9 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # With a block given, comparisons in the block determine the ordering. The block # is called with two elements `a` and `b`, and must return: # - # * A negative integer if `a < b`. - # * Zero if `a == b`. - # * A positive integer if `a > b`. + # * A negative integer if a < b. + # * Zero if a == b. + # * A positive integer if a > b. # # Examples: # @@ -1451,7 +1456,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # b.report("Sort by") { a.sort_by { |a| a } } # end # - # *produces:* + # produces: # # user system total real # Sort 0.180000 0.000000 0.180000 ( 0.175469) @@ -1647,7 +1652,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # rdoc-file=enum.c # - include?(object) -> true or false # --> - # Returns whether for any element `object == element`: + # Returns whether for any element object == element: # # (1..4).include?(2) # => true # (1..4).include?(5) # => false @@ -1699,13 +1704,13 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # product #=> 24 # # When this runs, the block is first called with `1` (the initial value) and `2` - # (the first element of the array). The block returns `1*2`, so on the next - # iteration the block is called with `2` (the previous result) and `3`. The - # block returns `6`, and is called one last time with `6` and `4`. The result of - # the block, `24` becomes the value returned by `inject`. This code returns the - # product of the elements in the enumerable. + # (the first element of the array). The block returns 1*2, so on + # the next iteration the block is called with `2` (the previous result) and `3`. + # The block returns `6`, and is called one last time with `6` and `4`. The + # result of the block, `24` becomes the value returned by `inject`. This code + # returns the product of the elements in the enumerable. # - # **First Shortcut: Default Initial value** + # First Shortcut: Default Initial value # # In the case of the previous example, the initial value, `1`, wasn't really # necessary: the calculation of the product of a list of numbers is @@ -1742,7 +1747,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # Note that the last line of the block is just the word `counts`. This ensures # the return value of the block is the result that's being calculated. # - # **Second Shortcut: a Reducer function** + # Second Shortcut: a Reducer function # # A *reducer function* is a function that takes a partial result and the next # value, returning the next partial result. The block that is given to `inject` @@ -1787,11 +1792,11 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # position = "nnneesw".chars.reduce(Turtle.new, :move) # position #=>> # # - # **Third Shortcut: Reducer With no Initial Value** + # Third Shortcut: Reducer With no Initial Value # # If your reducer returns a value that it can accept as a parameter, then you - # don't have to pass in an initial value. Here `:*` is the name of the *times* - # function: + # don't have to pass in an initial value. Here :* is the name of + # the *times* function: # # product = [ 2, 3, 4 ].inject(:*) # product # => 24 @@ -1854,7 +1859,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # - uniq {|element| ... } -> array # --> # With no block, returns a new array containing only unique elements; the array - # has no two elements `e0` and `e1` such that `e0.eql?(e1)`: + # has no two elements `e0` and `e1` such that e0.eql?(e1): # # %w[a b c c b a a b c].uniq # => ["a", "b", "c"] # [0, 1, 2, 2, 1, 0, 0, 1, 2].uniq # => [0, 1, 2] @@ -1881,12 +1886,12 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # (1..100).sum(1) # => 5051 # ('a'..'d').sum('foo') # => "fooabcd" # - # Generally, the sum is computed using methods `+` and `each`; for performance - # optimizations, those methods may not be used, and so any redefinition of those - # methods may not have effect here. + # Generally, the sum is computed using methods + and `each`; for + # performance optimizations, those methods may not be used, and so any + # redefinition of those methods may not have effect here. # # One such optimization: When possible, computes using Gauss's summation formula - # *n(n+1)/2*: + # n(n+1)/2: # # 100 * (100 + 1) / 2 # => 5050 # @@ -2025,8 +2030,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # - zip(*other_enums) {|array| ... } -> nil # --> # With no block given, returns a new array `new_array` of size self.size whose - # elements are arrays. Each nested array `new_array[n]` is of size - # `other_enums.size+1`, and contains: + # elements are arrays. Each nested array new_array[n] is of size + # other_enums.size+1, and contains: # # * The `n`-th element of self. # * The `n`-th element of each of the `other_enums`. @@ -2050,8 +2055,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # # [[:baz, 2], [:gaz, 5], [:haz, 8]] # # ] # - # If any enumerable in other_enums is smaller than self, fills to `self.size` - # with `nil`: + # If any enumerable in other_enums is smaller than self, fills to + # self.size with `nil`: # # a = [:a0, :a1, :a2, :a3] # b = [:b0, :b1, :b2] @@ -2135,8 +2140,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # ["E", 8736] # ["F", 6860] # - # You can use the special symbol `:_alone` to force an element into its own - # separate chunk: + # You can use the special symbol :_alone to force an element into + # its own separate chunk: # # a = [0, 0, 1, 1] # e = a.chunk{|i| i.even? ? :_alone : true } @@ -2151,8 +2156,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # } # } # - # You can use the special symbol `:_separator` or `nil` to force an element to - # be ignored (not included in any chunk): + # You can use the special symbol :_separator or `nil` to force an + # element to be ignored (not included in any chunk): # # a = [0, 0, -1, 1, 1] # e = a.chunk{|i| i < 0 ? :_separator : true } @@ -2314,11 +2319,11 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # Creates an enumerator for each chunked elements. The ends of chunks are # defined by *pattern* and the block. # - # If `_pattern_ === _elt_` returns `true` or the block returns `true` for the - # element, the element is end of a chunk. + # If _pattern_ === _elt_ returns `true` or the block returns `true` + # for the element, the element is end of a chunk. # - # The `===` and *block* is called from the first element to the last element of - # *enum*. + # The === and *block* is called from the first element to the last + # element of *enum*. # # The result enumerator yields the chunked elements as an array. So `each` # method can be called as follows: @@ -2349,7 +2354,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem] # --> # With argument `pattern`, returns an enumerator that uses the pattern to # partition elements into arrays ("slices"). An element begins a new slice if - # `element === pattern` (or if it is the first element). + # element === pattern (or if it is the first element). # # a = %w[foo bar fop for baz fob fog bam foy] # e = a.slice_before(/ba/) # => # diff --git a/core/enumerator.rbs b/core/enumerator.rbs index 3642751f0..abf3b42d3 100644 --- a/core/enumerator.rbs +++ b/core/enumerator.rbs @@ -171,8 +171,9 @@ class Enumerator[unchecked out Elem, out Return = void] < Object # # The optional `size` keyword argument specifies the size of the enumerator, # which can be retrieved by Enumerator#size. It can be an integer, - # `Float::INFINITY`, a callable object (such as a lambda), or `nil` to indicate - # unknown size. When not specified, the size defaults to `Float::INFINITY`. + # Float::INFINITY, a callable object (such as a lambda), or `nil` + # to indicate unknown size. When not specified, the size defaults to + # Float::INFINITY. # # # Infinite enumerator # enum = Enumerator.produce(1, size: Float::INFINITY, &:succ) @@ -305,7 +306,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object # # Iteration is defined by the given block, in which a "yielder" object, given as # block parameter, can be used to yield a value by calling the `yield` method - # (aliased as `<<`): + # (aliased as <<): # # fib = Enumerator.new do |y| # a = b = 1 diff --git a/core/errno.rbs b/core/errno.rbs index 55f67fc6f..b445e86d3 100644 --- a/core/errno.rbs +++ b/core/errno.rbs @@ -9,7 +9,7 @@ # # When the Ruby interpreter interacts with the operating system and receives # such an error code (e.g., `2`), it maps the code to a particular Ruby -# exception class (e.g., `Errno::ENOENT`): +# exception class (e.g., Errno::ENOENT): # # File.open('nosuch.txt') # # => No such file or directory @ rb_sysopen - nosuch.txt (Errno::ENOENT) @@ -25,7 +25,8 @@ # Errno::ENOENT.superclass # => SystemCallError # Errno::ENOENT::Errno # => 2 # -# The names of nested classes are returned by method `Errno.constants`: +# The names of nested classes are returned by method +# Errno.constants: # # Errno.constants.size # => 158 # Errno.constants.sort.take(5) # => [:E2BIG, :EACCES, :EADDRINUSE, :EADDRNOTAVAIL, :EADV] diff --git a/core/errors.rbs b/core/errors.rbs index 1a971c542..4ffb373b8 100644 --- a/core/errors.rbs +++ b/core/errors.rbs @@ -6,7 +6,7 @@ # # [1, 2, 3].first(4, 5) # -# *raises the exception:* +# raises the exception: # # ArgumentError: wrong number of arguments (given 2, expected 1) # @@ -14,7 +14,7 @@ # # [1, 2, 3].first(-4) # -# *raises the exception:* +# raises the exception: # # ArgumentError: negative array size # @@ -66,7 +66,7 @@ end # # [1, 2, 3].freeze << 4 # -# *raises the exception:* +# raises the exception: # # FrozenError: can't modify frozen Array # @@ -115,11 +115,11 @@ end # puts "Note: You will typically use Signal.trap instead." # end # -# *produces:* +# produces: # # Press ctrl-C when you get bored # -# *then waits until it is interrupted with Control-C and then prints:* +# then waits until it is interrupted with Control-C and then prints: # # Note: You will typically use Signal.trap instead. # @@ -184,7 +184,7 @@ end # # require 'this/file/does/not/exist' # -# *raises the exception:* +# raises the exception: # # LoadError: no such file to load -- this/file/does/not/exist # @@ -209,7 +209,7 @@ end # end # call_block # -# *raises the exception:* +# raises the exception: # # LocalJumpError: no block given (yield) # @@ -220,7 +220,7 @@ end # end # get_me_a_return.call # -# *raises the exception:* +# raises the exception: # # LocalJumpError: unexpected return # @@ -248,7 +248,7 @@ end # # puts foo # -# *raises the exception:* +# raises the exception: # # NameError: undefined local variable or method `foo' for main:Object # @@ -256,7 +256,7 @@ end # # Integer.const_set :answer, 42 # -# *raises the exception:* +# raises the exception: # # NameError: wrong constant name answer # @@ -350,7 +350,7 @@ end # # "hello".to_ary # -# *raises the exception:* +# raises the exception: # # NoMethodError: undefined method `to_ary' for an instance of String # @@ -360,11 +360,13 @@ class NoMethodError[T] < NameError[T] # - NoMethodError.new(msg=nil, name=nil, args=nil, private=false, receiver: nil) -> no_method_error # --> # Construct a NoMethodError exception for a method of the given name called with - # the given arguments. The name may be accessed using the `#name` method on the - # resulting object, and the arguments using the `#args` method. + # the given arguments. The name may be accessed using the #name + # method on the resulting object, and the arguments using the #args + # method. # # If *private* argument were passed, it designates method was attempted to call - # in private context, and can be accessed with `#private_call?` method. + # in private context, and can be accessed with #private_call? + # method. # # *receiver* argument stores an object whose method was called. # @@ -393,8 +395,8 @@ end # exception if the underlying operating system or Ruby runtime does not support # them. # -# Note that if `fork` raises a `NotImplementedError`, then `respond_to?(:fork)` -# returns `false`. +# Note that if `fork` raises a `NotImplementedError`, then +# respond_to?(:fork) returns `false`. # class NotImplementedError < ScriptError end @@ -404,7 +406,7 @@ end # # [1, 2, 3].drop(1 << 100) # -# *raises the exception:* +# raises the exception: # # RangeError: bignum too big to convert into `long' # @@ -416,7 +418,7 @@ end # # Regexp.new("?") # -# *raises the exception:* +# raises the exception: # # RegexpError: target of repeat operator is not specified: /?/ # @@ -429,7 +431,7 @@ end # # raise "ouch" # -# *raises the exception:* +# raises the exception: # # RuntimeError: ouch # @@ -461,7 +463,7 @@ end # puts "received Exception #{e}" # end # -# *produces:* +# produces: # # received Exception SIGHUP # @@ -502,7 +504,7 @@ end # # require 'does/not/exist' rescue "Hi" # -# *raises the exception:* +# raises the exception: # # LoadError: no such file to load -- does/not/exist # @@ -520,7 +522,7 @@ end # end # puts "Done!" # -# *produces:* +# produces: # # Hello # Done! @@ -560,7 +562,7 @@ end # # eval("1+1=2") # -# *raises the exception:* +# raises the exception: # # SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end # @@ -587,7 +589,7 @@ end # # File.open("does/not/exist") # -# *raises the exception:* +# raises the exception: # # Errno::ENOENT: No such file or directory - does/not/exist # @@ -614,7 +616,7 @@ class SystemCallError < StandardError # SystemCallError.new("foo", Errno::EPIPE::Errno) # #=> # # - # If *func* is not `nil`, it is appended to the message with "` @ `". + # If *func* is not `nil`, it is appended to the message with " @ ". # # SystemCallError.new("foo", Errno::EPIPE::Errno, "here") # #=> # @@ -685,7 +687,7 @@ end # end # me_myself_and_i # -# *raises the exception:* +# raises the exception: # # SystemStackError: stack level too deep # @@ -712,7 +714,7 @@ end # # [1, 2, 3].first("two") # -# *raises the exception:* +# raises the exception: # # TypeError: no implicit conversion of String into Integer # @@ -725,7 +727,7 @@ end # # throw "foo", "bar" # -# *raises the exception:* +# raises the exception: # # UncaughtThrowError: uncaught throw "foo" # @@ -741,7 +743,7 @@ class UncaughtThrowError < ArgumentError # # throw "foo", "bar" # - # *raises the exception:* + # raises the exception: # # UncaughtThrowError: uncaught throw "foo" # diff --git a/core/exception.rbs b/core/exception.rbs index cfedb2172..5cab02bf5 100644 --- a/core/exception.rbs +++ b/core/exception.rbs @@ -102,7 +102,7 @@ class Exception # Returns the backtrace (the list of code locations that led to the exception), # as an array of strings. # - # Example (assuming the code is stored in the file named `t.rb`): + # Example (assuming the code is stored in the file named t.rb): # # def division(numerator, denominator) # numerator / denominator @@ -136,7 +136,7 @@ class Exception # Returns the backtrace (the list of code locations that led to the exception), # as an array of Thread::Backtrace::Location instances. # - # Example (assuming the code is stored in the file named `t.rb`): + # Example (assuming the code is stored in the file named t.rb): # # def division(numerator, denominator) # numerator / denominator @@ -173,8 +173,8 @@ class Exception # rdoc-file=error.c # - cause -> exception or nil # --> - # Returns the previous value of global variable `$!`, which may be `nil` (see - # [Global Variables](rdoc-ref:exceptions.md@Global+Variables)): + # Returns the previous value of global variable $!, which may be + # `nil` (see [Global Variables](rdoc-ref:exceptions.md@Global+Variables)): # # begin # raise('Boom 0') @@ -237,10 +237,10 @@ class Exception # An overriding method must be tolerant of passed keyword arguments, which may # include (but may not be limited to): # - # * `:highlight`. - # * `:did_you_mean`. - # * `:error_highlight`. - # * `:syntax_suggest`. + # * :highlight. + # * :did_you_mean. + # * :error_highlight. + # * :syntax_suggest. # # An overriding method should also be careful with ANSI code enhancements; see # [Messages](rdoc-ref:exceptions.md@Messages). @@ -444,10 +444,10 @@ class Exception # message. # * Includes the [backtrace](rdoc-ref:exceptions.md@Backtraces): # - # * If the value of keyword `order` is `:top` (the default), lists the - # error message and the innermost backtrace entry first. - # * If the value of keyword `order` is `:bottom`, lists the error message - # the innermost entry last. + # * If the value of keyword `order` is :top (the default), + # lists the error message and the innermost backtrace entry first. + # * If the value of keyword `order` is :bottom, lists the + # error message the innermost entry last. # # Example: # diff --git a/core/fiber.rbs b/core/fiber.rbs index bf177bfe8..f1099af51 100644 --- a/core/fiber.rbs +++ b/core/fiber.rbs @@ -57,16 +57,16 @@ # # ## Non-blocking Fibers # -# The concept of *non-blocking fiber* was introduced in Ruby 3.0. A non-blocking -# fiber, when reaching an operation that would normally block the fiber (like -# `sleep`, or wait for another process or I/O) will yield control to other -# fibers and allow the *scheduler* to handle blocking and waking up (resuming) -# this fiber when it can proceed. +# The concept of non-blocking fiber was introduced in Ruby 3.0. A +# non-blocking fiber, when reaching an operation that would normally block the +# fiber (like `sleep`, or wait for another process or I/O) will yield control to +# other fibers and allow the *scheduler* to handle blocking and waking up +# (resuming) this fiber when it can proceed. # # For a Fiber to behave as non-blocking, it need to be created in Fiber.new with -# `blocking: false` (which is the default), and Fiber.scheduler should be set -# with Fiber.set_scheduler. If Fiber.scheduler is not set in the current thread, -# blocking and non-blocking fibers' behavior is identical. +# blocking: false (which is the default), and Fiber.scheduler +# should be set with Fiber.set_scheduler. If Fiber.scheduler is not set in the +# current thread, blocking and non-blocking fibers' behavior is identical. # # Ruby doesn't provide a scheduler class: it is expected to be implemented by # the user and correspond to Fiber::Scheduler. @@ -118,7 +118,7 @@ class Fiber < Object # - Fiber.blocking? -> false or 1 # --> # Returns `false` if the current fiber is non-blocking. Fiber is non-blocking if - # it was created via passing `blocking: false` to Fiber.new, or via + # it was created via passing blocking: false to Fiber.new, or via # Fiber.schedule. # # If the current Fiber is blocking, the method returns 1. Future developments @@ -176,18 +176,18 @@ class Fiber < Object # ...1 sec pause here... # I slept well # - # ...e.g. on the first blocking operation inside the Fiber (`sleep(1)`), the - # control is yielded to the outside code (main fiber), and *at the end of that - # execution*, the scheduler takes care of properly resuming all the blocked - # fibers. + # ...e.g. on the first blocking operation inside the Fiber + # (sleep(1)), the control is yielded to the outside code (main + # fiber), and *at the end of that execution*, the scheduler takes care of + # properly resuming all the blocked fibers. # # Note that the behavior described above is how the method is *expected* to # behave, actual behavior is up to the current scheduler's implementation of # Fiber::Scheduler#fiber method. Ruby doesn't enforce this method to behave in # any particular way. # - # If the scheduler is not set, the method raises `RuntimeError (No scheduler is - # available!)`. + # If the scheduler is not set, the method raises RuntimeError (No + # scheduler is available!). # def self.schedule: () { () -> void } -> Fiber @@ -208,11 +208,11 @@ class Fiber < Object # - Fiber.set_scheduler(scheduler) -> scheduler # --> # Sets the Fiber scheduler for the current thread. If the scheduler is set, - # non-blocking fibers (created by Fiber.new with `blocking: false`, or by - # Fiber.schedule) call that scheduler's hook methods on potentially blocking - # operations, and the current thread will call scheduler's `close` method on - # finalization (allowing the scheduler to properly manage all non-finished - # fibers). + # non-blocking fibers (created by Fiber.new with blocking: false, + # or by Fiber.schedule) call that scheduler's hook methods on potentially + # blocking operations, and the current thread will call scheduler's `close` + # method on finalization (allowing the scheduler to properly manage all + # non-finished fibers). # # `scheduler` can be an object of any class corresponding to Fiber::Scheduler. # Its implementation is up to the user. @@ -251,13 +251,13 @@ class Fiber < Object # f.resume # prints: current: nil # # ... and so on ... # - # If `blocking: false` is passed to `Fiber.new`, *and* current thread has a - # Fiber.scheduler defined, the Fiber becomes non-blocking (see "Non-blocking - # Fibers" section in class docs). + # If blocking: false is passed to Fiber.new, *and* + # current thread has a Fiber.scheduler defined, the Fiber becomes non-blocking + # (see "Non-blocking Fibers" section in class docs). # # If the `storage` is unspecified, the default is to inherit a copy of the - # storage from the current fiber. This is the same as specifying `storage: - # true`. + # storage from the current fiber. This is the same as specifying storage: + # true. # # Fiber[:x] = 1 # Fiber.new do @@ -277,8 +277,8 @@ class Fiber < Object # Otherwise, the given `storage` is used as the new fiber's storage, and it must # be an instance of Hash. # - # Explicitly using `storage: true` is currently experimental and may change in - # the future. + # Explicitly using storage: true is currently experimental and may + # change in the future. # def initialize: (?blocking: boolish, ?storage: true | Hash[interned, untyped] | nil) { (?) -> void } -> void @@ -364,8 +364,8 @@ class Fiber < Object # - fiber.blocking? -> true or false # --> # Returns `true` if `fiber` is blocking and `false` otherwise. Fiber is - # non-blocking if it was created via passing `blocking: false` to Fiber.new, or - # via Fiber.schedule. + # non-blocking if it was created via passing blocking: false to + # Fiber.new, or via Fiber.schedule. # # Note that, even if the method returns `false`, the fiber behaves differently # only if Fiber.scheduler is set in the current thread. @@ -389,9 +389,9 @@ class Fiber < Object # the given fiber and no other fiber, returning `nil` to another fiber if that # fiber was calling #resume or #transfer. # - # `Fiber#kill` only interrupts another fiber when it is in Fiber.yield. If - # called on the current fiber then it raises that exception at the `Fiber#kill` - # call site. + # Fiber#kill only interrupts another fiber when it is in + # Fiber.yield. If called on the current fiber then it raises that exception at + # the Fiber#kill call site. # # If the fiber has not been started, transition directly to the terminated # state. @@ -407,8 +407,8 @@ class Fiber < Object # - raise(exception, message = exception.to_s, backtrace = nil, cause: $!) # - raise(message = nil, cause: $!) # --> - # Raises an exception in the fiber at the point at which the last `Fiber.yield` - # was called. + # Raises an exception in the fiber at the point at which the last + # Fiber.yield was called. # # f = Fiber.new { # puts "Before the yield" @@ -472,8 +472,8 @@ class Fiber < Object # important fiber-storage state. You should mostly prefer to assign specific # keys in the storage using Fiber::[]=. # - # You can also use `Fiber.new(storage: nil)` to create a fiber with an empty - # storage. + # You can also use Fiber.new(storage: nil) to create a fiber with + # an empty storage. # # Example: # diff --git a/core/file.rbs b/core/file.rbs index ac28af7b2..06e084d94 100644 --- a/core/file.rbs +++ b/core/file.rbs @@ -2,7 +2,7 @@ # A File object is a representation of a file in the underlying platform. # # Class File extends module FileTest, supporting such singleton methods as -# `File.exist?`. +# File.exist?. # # ## About the Examples # @@ -93,8 +93,8 @@ # | 'a+' | Anywhere | 0 | End only | End | # |------|----------|----------|----------|-----------| # -# Note that modes `'r'` and `'r+'` are not allowed for a non-existent file -# (exception raised). +# Note that modes 'r' and 'r+' are not allowed for a +# non-existent file (exception raised). # # In the tables: # @@ -108,7 +108,7 @@ # # ##### Read/Write Modes for Existing File # -# * `'r'`: +# * 'r': # # * File is not initially truncated: # @@ -137,7 +137,7 @@ # # f.write('foo') # Raises IOError. # -# * `'w'`: +# * 'w': # # * File is initially truncated: # @@ -191,7 +191,7 @@ # # f.read # Raises IOError. # -# * `'a'`: +# * 'a': # # * File is not initially truncated: # @@ -223,7 +223,7 @@ # # f.read # Raises IOError. # -# * `'r+'`: +# * 'r+': # # * File is not initially truncated: # @@ -278,7 +278,7 @@ # File.read(path) # # => "WWWst lineXXXecond line\nFourth line\nFifth YYYe\n\u0000\u0000ZZZ" # -# * `'a+'`: +# * 'a+': # # * File is not initially truncated: # @@ -319,10 +319,10 @@ # # ##### Read/Write Modes for File To Be Created # -# Note that modes `'r'` and `'r+'` are not allowed for a non-existent file -# (exception raised). +# Note that modes 'r' and 'r+' are not allowed for a +# non-existent file (exception raised). # -# * `'w'`: +# * 'w': # # * File's initial write position is 0: # @@ -372,7 +372,7 @@ # # f.read # Raises IOError. # -# * `'a'`: +# * 'a': # # * File's initial write position is 0: # @@ -399,7 +399,7 @@ # # f.read # Raises IOError. # -# * `'w+'`: +# * 'w+': # # * File's initial position is 0: # @@ -463,7 +463,7 @@ # f.read # # => "bah" # -# * `'a+'`: +# * 'a+': # # * File's initial write position is 0: # @@ -506,12 +506,13 @@ # To specify whether data is to be treated as text or as binary data, either of # the following may be suffixed to any of the string read/write modes above: # -# * `'t'`: Text data; sets the default external encoding to `Encoding::UTF_8`; -# on Windows, enables conversion between EOL and CRLF and enables -# interpreting `0x1A` as an end-of-file marker. -# * `'b'`: Binary data; sets the default external encoding to -# `Encoding::ASCII_8BIT`; on Windows, suppresses conversion between EOL and -# CRLF and disables interpreting `0x1A` as an end-of-file marker. +# * 't': Text data; sets the default external encoding to +# Encoding::UTF_8; on Windows, enables conversion between EOL +# and CRLF and enables interpreting `0x1A` as an end-of-file marker. +# * 'b': Binary data; sets the default external encoding to +# Encoding::ASCII_8BIT; on Windows, suppresses conversion +# between EOL and CRLF and disables interpreting `0x1A` as an end-of-file +# marker. # # If neither is given, the stream defaults to text data. # @@ -530,8 +531,8 @@ # # The following may be suffixed to any writable string mode above: # -# * `'x'`: Creates the file if it does not exist; raises an exception if the -# file exists. +# * 'x': Creates the file if it does not exist; raises an +# exception if the file exists. # # Example: # @@ -546,12 +547,12 @@ # ### Integer Access Modes # # When mode is an integer it must be one or more of the following constants, -# which may be combined by the bitwise OR operator `|`: +# which may be combined by the bitwise OR operator |: # -# * `File::RDONLY`: Open for reading only. -# * `File::WRONLY`: Open for writing only. -# * `File::RDWR`: Open for reading and writing. -# * `File::APPEND`: Open for appending only. +# * File::RDONLY: Open for reading only. +# * File::WRONLY: Open for writing only. +# * File::RDWR: Open for reading and writing. +# * File::APPEND: Open for appending only. # # Examples: # @@ -565,19 +566,19 @@ # # These constants may also be ORed into the integer mode: # -# * `File::CREAT`: Create file if it does not exist. -# * `File::EXCL`: Raise an exception if `File::CREAT` is given and the file -# exists. +# * File::CREAT: Create file if it does not exist. +# * File::EXCL: Raise an exception if File::CREAT is +# given and the file exists. # # ### Data Mode Specified as an Integer # # Data mode cannot be specified as an integer. When the stream access mode is # given as an integer, the data mode is always text, never binary. # -# Note that although there is a constant `File::BINARY`, setting its value in an -# integer stream mode has no effect; this is because, as documented in -# File::Constants, the `File::BINARY` value disables line code conversion, but -# does not change the external encoding. +# Note that although there is a constant File::BINARY, setting its +# value in an integer stream mode has no effect; this is because, as documented +# in File::Constants, the File::BINARY value disables line code +# conversion, but does not change the external encoding. # # ### Encodings # @@ -608,14 +609,14 @@ # internal to external encoding. For further details about transcoding input and # output, see [Encodings](rdoc-ref:encodings.rdoc@Encodings). # -# If the external encoding is `'BOM|UTF-8'`, `'BOM|UTF-16LE'` or -# `'BOM|UTF16-BE'`, Ruby checks for a Unicode BOM in the input document to help -# determine the encoding. For UTF-16 encodings the file open mode must be -# binary. If the BOM is found, it is stripped and the external encoding from the -# BOM is used. +# If the external encoding is 'BOM|UTF-8', +# 'BOM|UTF-16LE' or 'BOM|UTF16-BE', Ruby checks for a +# Unicode BOM in the input document to help determine the encoding. For UTF-16 +# encodings the file open mode must be binary. If the BOM is found, it is +# stripped and the external encoding from the BOM is used. # -# Note that the BOM-style encoding option is case insensitive, so `'bom|utf-8'` -# is also valid. +# Note that the BOM-style encoding option is case insensitive, so +# 'bom|utf-8' is also valid. # # ## File Permissions # @@ -669,7 +670,7 @@ # # Various constants for use in File and IO methods may be found in module # File::Constants; an array of their names is returned by -# `File::Constants.constants`. +# File::Constants.constants. # # ## What's Here # @@ -705,7 +706,7 @@ # * ::basename: Returns the last component of the given file path. # * ::dirname: Returns all but the last component of the given file path. # * ::expand_path: Returns the absolute file path for the given path, -# expanding `~` for a home directory. +# expanding ~ for a home directory. # * ::extname: Returns the file extension for the given file path. # * ::fnmatch? (aliased as ::fnmatch): Returns whether the given file path # matches the given pattern. @@ -879,8 +880,8 @@ class File < IO # Converts a pathname to an absolute pathname. Relative paths are referenced # from the current working directory of the process unless *dir_string* is # given, in which case it will be used as the starting point. If the given - # pathname starts with a ```~`'' it is NOT expanded, it is treated as a normal - # directory name. + # pathname starts with a ``~'' it is NOT expanded, it is treated as + # a normal directory name. # # File.absolute_path("~oracle/bin") #=> "/~oracle/bin" # @@ -966,8 +967,8 @@ class File < IO # --> # Changes permission bits on the named file(s) to the bit pattern represented by # *mode_int*. Actual effects are operating system dependent (see the beginning - # of this section). On Unix systems, see `chmod(2)` for details. Returns the - # number of files processed. + # of this section). On Unix systems, see chmod(2) for details. + # Returns the number of files processed. # # File.chmod(0644, "testfile", "out") #=> 2 # @@ -1009,9 +1010,9 @@ class File < IO # --> # Deletes the named files, returning the number of names passed as arguments. # Raises an exception on any error. Since the underlying implementation relies - # on the `unlink(2)` system call, the type of exception raised depends on its - # error type (see https://linux.die.net/man/2/unlink) and has the form of e.g. - # Errno::ENOENT. + # on the unlink(2) system call, the type of exception raised + # depends on its error type (see https://linux.die.net/man/2/unlink) and has the + # form of e.g. Errno::ENOENT. # # See also Dir::rmdir. # @@ -1114,9 +1115,9 @@ class File < IO # Converts a pathname to an absolute pathname. Relative paths are referenced # from the current working directory of the process unless `dir_string` is # given, in which case it will be used as the starting point. The given pathname - # may start with a ```~`'', which expands to the process owner's home directory - # (the environment variable `HOME` must be set correctly). ```~`*user*'' expands - # to the named user's home directory. + # may start with a ``~'', which expands to the process owner's home + # directory (the environment variable `HOME` must be set correctly). + # ``~*user*'' expands to the named user's home directory. # # File.expand_path("~oracle/bin") #=> "/home/oracle/bin" # @@ -1130,7 +1131,7 @@ class File < IO # #=> ".../path/to/project/lib/mygem.rb" # # So first it resolves the parent of __FILE__, that is bin/, then go to the - # parent, the root of the project and appends `lib/mygem.rb`. + # parent, the root of the project and appends lib/mygem.rb. # def self.expand_path: (path file_name, ?path dir_string) -> String @@ -1182,48 +1183,48 @@ class File < IO # regular expression; instead it follows rules similar to shell filename # globbing. It may contain the following metacharacters: # - # `*` + # * # : Matches any file. Can be restricted by other values in the glob. - # Equivalent to `/.*/x` in regexp. + # Equivalent to /.*/x in regexp. # - # `*` + # * # : Matches all regular files # - # `c*` + # c* # : Matches all files beginning with `c` # - # `*c` + # *c # : Matches all files ending with `c` # - # `*c*` + # *c* # : Matches all files that have `c` in them (including at the beginning or # end). # # - # To match hidden files (that start with a `.`) set the File::FNM_DOTMATCH - # flag. + # To match hidden files (that start with a .) set the + # File::FNM_DOTMATCH flag. # # - # `**` + # ** # : Matches directories recursively or files expansively. # # - # `?` - # : Matches any one character. Equivalent to `/.{1}/` in regexp. + # ? + # : Matches any one character. Equivalent to /.{1}/ in regexp. # # - # `[set]` + # [set] # : Matches any one character in `set`. Behaves exactly like character sets - # in Regexp, including set negation (`[^a-z]`). + # in Regexp, including set negation ([^a-z]). # # - # `\` + # \ # : Escapes the next metacharacter. # # - # `{a,b}` + # {a,b} # : Matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled. - # Behaves like a Regexp union (`(?:a|b)`). + # Behaves like a Regexp union ((?:a|b)). # # # `flags` is a bitwise OR of the `FNM_XXX` constants. The same glob pattern and @@ -1333,7 +1334,7 @@ class File < IO # rdoc-file=file.c # - File.join(string, ...) -> string # --> - # Returns a new string formed by joining the strings using `"/"`. + # Returns a new string formed by joining the strings using "/". # # File.join("usr", "mail", "gumby") #=> "usr/mail/gumby" # @@ -1513,8 +1514,8 @@ class File < IO # 1. It must be in an ASCII-compatible encoding; otherwise, an # Encoding::CompatibilityError is raised. # - # 2. It must not contain the NUL character (`\0`); otherwise, an ArgumentError - # is raised. + # 2. It must not contain the NUL character (\0); otherwise, an + # ArgumentError is raised. # def self.path: (path path) -> String @@ -1750,9 +1751,9 @@ class File < IO # --> # Deletes the named files, returning the number of names passed as arguments. # Raises an exception on any error. Since the underlying implementation relies - # on the `unlink(2)` system call, the type of exception raised depends on its - # error type (see https://linux.die.net/man/2/unlink) and has the form of e.g. - # Errno::ENOENT. + # on the unlink(2) system call, the type of exception raised + # depends on its error type (see https://linux.die.net/man/2/unlink) and has the + # form of e.g. Errno::ENOENT. # # See also Dir::rmdir. # @@ -1775,7 +1776,7 @@ class File < IO # --> # If *file_name* is readable by others, returns an integer representing the file # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the - # bits is platform dependent; on Unix systems, see `stat(2)`. + # bits is platform dependent; on Unix systems, see stat(2). # # *file_name* can be an IO object. # @@ -1791,7 +1792,7 @@ class File < IO # --> # If *file_name* is writable by others, returns an integer representing the file # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the - # bits is platform dependent; on Unix systems, see `stat(2)`. + # bits is platform dependent; on Unix systems, see stat(2). # # *file_name* can be an IO object. # @@ -1864,7 +1865,8 @@ class File < IO # --> # Changes permission bits on *file* to the bit pattern represented by # *mode_int*. Actual effects are platform dependent; on Unix systems, see - # `chmod(2)` for details. Follows symbolic links. Also see File#lchmod. + # chmod(2) for details. Follows symbolic links. Also see + # File#lchmod. # # f = File.new("out", "w"); # f.chmod(0644) #=> 0 @@ -1902,18 +1904,18 @@ class File < IO # rdoc-file=file.c # - flock(locking_constant) -> 0 or false # --> - # Locks or unlocks file `self` according to the given `locking_constant`, + # Locks or unlocks file +self+ according to the given `locking_constant`, # a bitwise OR of the values in the table below. # Not available on all platforms. - # Returns `false` if `File::LOCK_NB` is specified and the operation would have - # blocked; + # Returns `false` if File::LOCK_NB is specified and the operation + # would have blocked; # otherwise returns `0`. - # Constant | Lock | Effect - # ---------------|------------|------------------------------------------------------------------------------------------------------- - # `File::LOCK_EX`| Exclusive | Only one process may hold an exclusive lock for `self` at a time. - # `File::LOCK_NB`|Non-blocking|No blocking; may be combined with `File::LOCK_SH` or `File::LOCK_EX` using the bitwise OR operator `|`. - # `File::LOCK_SH`| Shared | Multiple processes may each hold a shared lock for `self` at the same time. - # `File::LOCK_UN`| Unlock | Remove an existing lock held by this process. + # Constant | Lock | Effect + # ---------------|------------|------------------------------------------------------------------------------------------------------------------ + # +File::LOCK_EX+| Exclusive | Only one process may hold an exclusive lock for +self+ at a time. + # +File::LOCK_NB+|Non-blocking|No blocking; may be combined with +File::LOCK_SH+ or +File::LOCK_EX+ using the bitwise OR operator |. + # +File::LOCK_SH+| Shared | Multiple processes may each hold a shared lock for +self+ at the same time. + # +File::LOCK_UN+| Unlock | Remove an existing lock held by this process. # Example: # # Update a counter using an exclusive lock. # # Don't use File::WRONLY because it truncates the file. @@ -2039,7 +2041,7 @@ File::SEPARATOR: String File::Separator: String # -# Module `File::Constants` defines file-related constants. +# Module File::Constants defines file-related constants. # # There are two families of constants here: # @@ -2303,14 +2305,14 @@ File::Separator: String # # #### File::FNM_DOTMATCH # -# Flag File::FNM_DOTMATCH makes the `'*'` pattern match a filename starting with -# `'.'`. +# Flag File::FNM_DOTMATCH makes the '*' pattern match a filename +# starting with '.'. # # #### File::FNM_EXTGLOB # -# Flag File::FNM_EXTGLOB enables pattern `'{_a_,_b_}'`, which matches pattern -# '*a*' and pattern '*b*'; behaves like a [regexp union](rdoc-ref:Regexp.union) -# (e.g., `'(?:_a_|_b_)'`): +# Flag File::FNM_EXTGLOB enables pattern '{_a_,_b_}', which matches +# pattern '*a*' and pattern '*b*'; behaves like a [regexp +# union](rdoc-ref:Regexp.union) (e.g., '(?:_a_|_b_)'): # # pattern = '{LEGAL,BSDL}' # Dir.glob(pattern) # => ["LEGAL", "BSDL"] @@ -2319,12 +2321,13 @@ File::Separator: String # # #### File::FNM_NOESCAPE # -# Flag File::FNM_NOESCAPE disables `'\'` escaping. +# Flag File::FNM_NOESCAPE disables '\' escaping. # # #### File::FNM_PATHNAME # -# Flag File::FNM_PATHNAME specifies that patterns `'*'` and `'?'` do not match -# the directory separator (the value of constant File::SEPARATOR). +# Flag File::FNM_PATHNAME specifies that patterns '*' and +# '?' do not match the directory separator (the value of constant +# File::SEPARATOR). # # #### File::FNM_SHORTNAME # @@ -2343,8 +2346,8 @@ File::Separator: String # # Flag File::NULL contains the string value of the null device: # -# * On a Unix-like OS, `'/dev/null'`. -# * On Windows, `'NUL'`. +# * On a Unix-like OS, '/dev/null'. +# * On Windows, 'NUL'. # module File::Constants end @@ -2527,13 +2530,13 @@ class File::Stat < Object # - self <=> other -> -1, 0, 1, or nil # --> # Compares `self` and `other`, by comparing their modification times; that is, - # by comparing `self.mtime` and `other.mtime`. + # by comparing self.mtime and other.mtime. # # Returns: # - # * `-1`, if `self.mtime` is earlier. + # * -1, if self.mtime is earlier. # * `0`, if the two values are equal. - # * `1`, if `self.mtime` is later. + # * `1`, if self.mtime is later. # * `nil`, if `other` is not a File::Stat object. # # Examples: @@ -2657,7 +2660,7 @@ class File::Stat < Object # rdoc-file=file.c # - stat.dev_major -> integer # --> - # Returns the major part of `File_Stat#dev` or `nil`. + # Returns the major part of File_Stat#dev or `nil`. # # File.stat("/dev/fd1").dev_major #=> 2 # File.stat("/dev/tty").dev_major #=> 5 @@ -2668,7 +2671,7 @@ class File::Stat < Object # rdoc-file=file.c # - stat.dev_minor -> integer # --> - # Returns the minor part of `File_Stat#dev` or `nil`. + # Returns the minor part of File_Stat#dev or `nil`. # # File.stat("/dev/fd1").dev_minor #=> 1 # File.stat("/dev/tty").dev_minor #=> 0 @@ -2702,7 +2705,8 @@ class File::Stat < Object # rdoc-file=file.c # - stat.executable_real? -> true or false # --> - # Same as `executable?`, but tests using the real owner of the process. + # Same as executable?, but tests using the real owner of the + # process. # def executable_real?: () -> bool @@ -2782,7 +2786,7 @@ class File::Stat < Object # - stat.mode -> integer # --> # Returns an integer representing the permission bits of *stat*. The meaning of - # the bits is platform dependent; on Unix systems, see `stat(2)`. + # the bits is platform dependent; on Unix systems, see stat(2). # # File.chmod(0644, "testfile") #=> 1 # s = File.stat("testfile") @@ -2849,7 +2853,7 @@ class File::Stat < Object # rdoc-file=file.c # - stat.rdev_major -> integer # --> - # Returns the major part of `File_Stat#rdev` or `nil`. + # Returns the major part of File_Stat#rdev or `nil`. # # File.stat("/dev/fd1").rdev_major #=> 2 # File.stat("/dev/tty").rdev_major #=> 5 @@ -2860,7 +2864,7 @@ class File::Stat < Object # rdoc-file=file.c # - stat.rdev_minor -> integer # --> - # Returns the minor part of `File_Stat#rdev` or `nil`. + # Returns the minor part of File_Stat#rdev or `nil`. # # File.stat("/dev/fd1").rdev_minor #=> 1 # File.stat("/dev/tty").rdev_minor #=> 0 @@ -2983,7 +2987,7 @@ class File::Stat < Object # --> # If *stat* is readable by others, returns an integer representing the file # permission bits of *stat*. Returns `nil` otherwise. The meaning of the bits is - # platform dependent; on Unix systems, see `stat(2)`. + # platform dependent; on Unix systems, see stat(2). # # m = File.stat("/etc/passwd").world_readable? #=> 420 # sprintf("%o", m) #=> "644" @@ -2996,7 +3000,7 @@ class File::Stat < Object # --> # If *stat* is writable by others, returns an integer representing the file # permission bits of *stat*. Returns `nil` otherwise. The meaning of the bits is - # platform dependent; on Unix systems, see `stat(2)`. + # platform dependent; on Unix systems, see stat(2). # # m = File.stat("/tmp").world_writable? #=> 511 # sprintf("%o", m) #=> "777" diff --git a/core/file_test.rbs b/core/file_test.rbs index fa4e8de71..2842aa068 100644 --- a/core/file_test.rbs +++ b/core/file_test.rbs @@ -269,7 +269,7 @@ module FileTest # --> # If *file_name* is readable by others, returns an integer representing the file # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the - # bits is platform dependent; on Unix systems, see `stat(2)`. + # bits is platform dependent; on Unix systems, see stat(2). # # *file_name* can be an IO object. # @@ -285,7 +285,7 @@ module FileTest # --> # If *file_name* is writable by others, returns an integer representing the file # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the - # bits is platform dependent; on Unix systems, see `stat(2)`. + # bits is platform dependent; on Unix systems, see stat(2). # # *file_name* can be an IO object. # diff --git a/core/float.rbs b/core/float.rbs index 3e779cc6a..d5d00a50a 100644 --- a/core/float.rbs +++ b/core/float.rbs @@ -12,7 +12,7 @@ # # Others cannot; among these are the transcendental numbers, including: # -# * Pi, *π*: in mathematics, a number of infinite precision: +# * Pi, π: in mathematics, a number of infinite precision: # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited # precision (in this case, to 16 decimal places): # @@ -32,8 +32,8 @@ # Others do not: # # * In mathematics, 2/3 as a decimal number is an infinitely-repeating -# decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in -# this case, to 16 decimal places): +# decimal: 0.666... (forever); in Ruby, 2.0/3 is of limited +# precision (in this case, to 16 decimal places): # # 2.0/3 # => 0.6666666666666666 # @@ -139,7 +139,7 @@ # # Others cannot; among these are the transcendental numbers, including: # -# * Pi, *π*: in mathematics, a number of infinite precision: +# * Pi, π: in mathematics, a number of infinite precision: # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited # precision (in this case, to 16 decimal places): # @@ -159,8 +159,8 @@ # Others do not: # # * In mathematics, 2/3 as a decimal number is an infinitely-repeating -# decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in -# this case, to 16 decimal places): +# decimal: 0.666... (forever); in Ruby, 2.0/3 is of limited +# precision (in this case, to 16 decimal places): # # 2.0/3 # => 0.6666666666666666 # @@ -390,7 +390,8 @@ class Float < Numeric # 2.0 < Rational(3, 1) # => true # 2.0 < 2.0 # => false # - # `Float::NAN < Float::NAN` returns an implementation-dependent value. + # Float::NAN < Float::NAN returns an implementation-dependent + # value. # def <: (Numeric) -> bool @@ -407,7 +408,8 @@ class Float < Numeric # 2.0 <= 2.0 # => true # 2.0 <= 1.0 # => false # - # `Float::NAN <= Float::NAN` returns an implementation-dependent value. + # Float::NAN <= Float::NAN returns an implementation-dependent + # value. # def <=: (Numeric) -> bool @@ -419,7 +421,7 @@ class Float < Numeric # # Returns: # - # * `-1`, if `self` is less than `other`. + # * -1, if `self` is less than `other`. # * `0`, if `self` is equal to `other`. # * `1`, if `self` is greater than `other`. # * `nil`, if the two values are incommensurate. @@ -434,7 +436,8 @@ class Float < Numeric # 2.0 <=> 1.9 # => 1 # 2.0 <=> 'foo' # => nil # - # `Float::NAN <=> Float::NAN` returns an implementation-dependent value. + # Float::NAN <=> Float::NAN returns an implementation-dependent + # value. # # Class Float includes module Comparable, each of whose methods uses Float#<=> # for comparison. @@ -452,7 +455,8 @@ class Float < Numeric # 2.0 == Rational(2, 1) # => true # 2.0 == Complex(2, 0) # => true # - # `Float::NAN == Float::NAN` returns an implementation-dependent value. + # Float::NAN == Float::NAN returns an implementation-dependent + # value. # # Related: Float#eql? (requires `other` to be a Float). # @@ -466,7 +470,8 @@ class Float < Numeric # 2.0 == Rational(2, 1) # => true # 2.0 == Complex(2, 0) # => true # - # `Float::NAN == Float::NAN` returns an implementation-dependent value. + # Float::NAN == Float::NAN returns an implementation-dependent + # value. # # Related: Float#eql? (requires `other` to be a Float). # @@ -483,7 +488,8 @@ class Float < Numeric # 2.0 > Rational(1, 2) # => true # 2.0 > 2.0 # => false # - # `Float::NAN > Float::NAN` returns an implementation-dependent value. + # Float::NAN > Float::NAN returns an implementation-dependent + # value. # def >: (Numeric) -> bool @@ -499,7 +505,8 @@ class Float < Numeric # 2.0 >= 2.0 # => true # 2.0 >= 2.1 # => false # - # `Float::NAN >= Float::NAN` returns an implementation-dependent value. + # Float::NAN >= Float::NAN returns an implementation-dependent + # value. # def >=: (Numeric) -> bool @@ -554,7 +561,7 @@ class Float < Numeric # # When `ndigits` is non-positive, # returns an Integer based on a computed granularity: - # * The granularity is `10 ** ndigits.abs`. + # * The granularity is 10 ** ndigits.abs. # * The returned value is the largest multiple of the granularity # that is less than or equal to `self`. # Examples with positive `self`: @@ -620,7 +627,7 @@ class Float < Numeric # rdoc-file=numeric.c # - divmod(other) -> array # --> - # Returns a 2-element array `[q, r]`, where + # Returns a 2-element array [q, r], where # # q = (self/other).floor # Quotient # r = self % other # Remainder @@ -656,7 +663,8 @@ class Float < Numeric # 2.0.eql?(Rational(2, 1)) # => false # 2.0.eql?(Complex(2, 0)) # => false # - # `Float::NAN.eql?(Float::NAN)` returns an implementation-dependent value. + # Float::NAN.eql?(Float::NAN) returns an implementation-dependent + # value. # # Related: Float#== (performs type conversions). # @@ -678,8 +686,8 @@ class Float < Numeric # rdoc-file=numeric.c # - finite? -> true or false # --> - # Returns `true` if `self` is not `Infinity`, `-Infinity`, or `NaN`, `false` - # otherwise: + # Returns `true` if `self` is not `Infinity`, -Infinity, or `NaN`, + # `false` otherwise: # # f = 2.0 # => 2.0 # f.finite? # => true @@ -724,7 +732,7 @@ class Float < Numeric # # When `self` is non-zero and `ndigits` is non-positive, # returns an integer value based on a computed granularity: - # * The granularity is `10 ** ndigits.abs`. + # * The granularity is 10 ** ndigits.abs. # * The returned value is the largest multiple of the granularity # that is less than or equal to `self`. # Examples with positive `self`: @@ -772,7 +780,7 @@ class Float < Numeric # Returns: # # * 1, if `self` is `Infinity`. - # * -1 if `self` is `-Infinity`. + # * -1 if `self` is -Infinity. # * `nil`, otherwise. # # Examples: @@ -870,7 +878,7 @@ class Float < Numeric # Returns the next-larger representable Float. # # These examples show the internally stored values (64-bit hexadecimal) for each - # Float `f` and for the corresponding `f.next_float`: + # Float `f` and for the corresponding f.next_float: # # f = 0.0 # 0x0000000000000000 # f.next_float # 0x0000000000000001 @@ -944,7 +952,7 @@ class Float < Numeric # Returns the next-smaller representable Float. # # These examples show the internally stored values (64-bit hexadecimal) for each - # Float `f` and for the corresponding `f.pev_float`: + # Float `f` and for the corresponding f.pev_float: # # f = 5e-324 # 0x0000000000000001 # f.prev_float # 0x0000000000000000 @@ -1025,8 +1033,8 @@ class Float < Numeric # f.round(1) # => -12345.7 # f.round(3) # => -12345.679 # - # When `ndigits` is negative, returns an integer with at least `ndigits.abs` - # trailing zeros: + # When `ndigits` is negative, returns an integer with at least + # ndigits.abs trailing zeros: # # f = 12345.6789 # f.round(0) # => 12346 @@ -1038,19 +1046,20 @@ class Float < Numeric # If keyword argument `half` is given, and `self` is equidistant from the two # candidate values, the rounding is according to the given `half` value: # - # * `:up` or `nil`: round away from zero: + # * :up or `nil`: round away from zero: # # 2.5.round(half: :up) # => 3 # 3.5.round(half: :up) # => 4 # (-2.5).round(half: :up) # => -3 # - # * `:down`: round toward zero: + # * :down: round toward zero: # # 2.5.round(half: :down) # => 2 # 3.5.round(half: :down) # => 3 # (-2.5).round(half: :down) # => -2 # - # * `:even`: round toward the candidate whose last nonzero digit is even: + # * :even: round toward the candidate whose last nonzero digit is + # even: # # 2.5.round(half: :even) # => 2 # 3.5.round(half: :even) # => 4 @@ -1163,8 +1172,8 @@ class Float < Numeric # f.truncate(1) # => -12345.6 # f.truncate(3) # => -12345.678 # - # When `ndigits` is negative, returns an integer with at least `ndigits.abs` - # trailing zeros: + # When `ndigits` is negative, returns an integer with at least + # ndigits.abs trailing zeros: # # f = 12345.6789 # f.truncate(0) # => 12345 @@ -1250,8 +1259,8 @@ Float::MAX_EXP: Integer # Usually defaults to 2.2250738585072014e-308. # # If the platform supports denormalized numbers, there are numbers between zero -# and Float::MIN. `0.0.next_float` returns the smallest positive floating point -# number including denormalized numbers. +# and Float::MIN. 0.0.next_float returns the smallest positive +# floating point number including denormalized numbers. # Float::MIN: Float diff --git a/core/gc.rbs b/core/gc.rbs index 868d05b88..a675cbaf7 100644 --- a/core/gc.rbs +++ b/core/gc.rbs @@ -182,21 +182,21 @@ module GC # GC.config(foo: 'bar') # # => {rgengc_allow_full_mark: false, implementation: "default"} # - # **All-Implementations Configuration** + # All-Implementations Configuration # # The single read-only entry for all implementations is: # - # * `:implementation`: the string name of the implementation; for the Ruby - # default implementation, `'default'`. + # * :implementation: the string name of the implementation; for + # the Ruby default implementation, 'default'. # - # **Implementation-Specific Configuration** + # Implementation-Specific Configuration # # A GC implementation maintains its own implementation-specific configuration. # # For Ruby's default implementation the single entry is: # - # * `:rgengc_allow_full_mark`: Controls whether the GC is allowed to run a - # full mark (young & old objects): + # * :rgengc_allow_full_mark: Controls whether the GC is allowed + # to run a full mark (young & old objects): # # * `true` (default): GC interleaves major and minor collections. A flag # is set to notify GC that a full mark has been requested. This flag is @@ -348,59 +348,66 @@ module GC # # The hash includes entries such as: # - # * `:count`: The total number of garbage collections run since application - # start (count includes both minor and major garbage collections). - # * `:time`: The total time spent in garbage collections (in milliseconds). - # * `:heap_allocated_pages`: The total number of allocated pages. - # * `:heap_empty_pages`: The number of pages with no live objects, and that - # could be released to the system. - # * `:heap_sorted_length`: The number of pages that can fit into the buffer - # that holds references to all pages. - # * `:heap_allocatable_pages`: The total number of pages the application could - # allocate without additional GC. - # * `:heap_available_slots`: The total number of slots in all - # `:heap_allocated_pages`. - # * `:heap_live_slots`: The total number of slots which contain live objects. - # * `:heap_free_slots`: The total number of slots which do not contain live - # objects. - # * `:heap_final_slots`: The total number of slots with pending finalizers to - # be run. - # * `:heap_marked_slots`: The total number of objects marked in the last GC. - # * `:heap_eden_pages`: The total number of pages which contain at least one - # live slot. - # * `:total_allocated_pages`: The cumulative number of pages allocated since - # application start. - # * `:total_freed_pages`: The cumulative number of pages freed since - # application start. - # * `:total_allocated_objects`: The cumulative number of objects allocated + # * :count: The total number of garbage collections run since + # application start (count includes both minor and major garbage + # collections). + # * :time: The total time spent in garbage collections (in + # milliseconds). + # * :heap_allocated_pages: The total number of allocated pages. + # * :heap_empty_pages: The number of pages with no live objects, + # and that could be released to the system. + # * :heap_sorted_length: The number of pages that can fit into + # the buffer that holds references to all pages. + # * :heap_allocatable_pages: The total number of pages the + # application could allocate without additional GC. + # * :heap_available_slots: The total number of slots in all + # :heap_allocated_pages. + # * :heap_live_slots: The total number of slots which contain + # live objects. + # * :heap_free_slots: The total number of slots which do not + # contain live objects. + # * :heap_final_slots: The total number of slots with pending + # finalizers to be run. + # * :heap_marked_slots: The total number of objects marked in the + # last GC. + # * :heap_eden_pages: The total number of pages which contain at + # least one live slot. + # * :total_allocated_pages: The cumulative number of pages + # allocated since application start. + # * :total_freed_pages: The cumulative number of pages freed # since application start. - # * `:total_freed_objects`: The cumulative number of objects freed since - # application start. - # * `:malloc_increase_bytes`: Amount of memory allocated on the heap for - # objects. Decreased by any GC. - # * `:malloc_increase_bytes_limit`: When `:malloc_increase_bytes` crosses this - # limit, GC is triggered. - # * `:minor_gc_count`: The total number of minor garbage collections run since - # process start. - # * `:major_gc_count`: The total number of major garbage collections run since + # * :total_allocated_objects: The cumulative number of objects + # allocated since application start. + # * :total_freed_objects: The cumulative number of objects freed + # since application start. + # * :malloc_increase_bytes: Amount of memory allocated on the + # heap for objects. Decreased by any GC. + # * :malloc_increase_bytes_limit: When + # :malloc_increase_bytes crosses this limit, GC is triggered. + # * :minor_gc_count: The total number of minor garbage + # collections run since process start. + # * :major_gc_count: The total number of major garbage + # collections run since process start. + # * :compact_count: The total number of compactions run since # process start. - # * `:compact_count`: The total number of compactions run since process start. - # * `:read_barrier_faults`: The total number of times the read barrier was - # triggered during compaction. - # * `:total_moved_objects`: The total number of objects compaction has moved. - # * `:remembered_wb_unprotected_objects`: The total number of objects without - # write barriers. - # * `:remembered_wb_unprotected_objects_limit`: When - # `:remembered_wb_unprotected_objects` crosses this limit, major GC is - # triggered. - # * `:old_objects`: Number of live, old objects which have survived at least 3 - # garbage collections. - # * `:old_objects_limit`: When `:old_objects` crosses this limit, major GC is + # * :read_barrier_faults: The total number of times the read + # barrier was triggered during compaction. + # * :total_moved_objects: The total number of objects compaction + # has moved. + # * :remembered_wb_unprotected_objects: The total number of + # objects without write barriers. + # * :remembered_wb_unprotected_objects_limit: When + # :remembered_wb_unprotected_objects crosses this limit, major + # GC is triggered. + # * :old_objects: Number of live, old objects which have survived + # at least 3 garbage collections. + # * :old_objects_limit: When :old_objects crosses + # this limit, major GC is triggered. + # * :oldmalloc_increase_bytes: Amount of memory allocated on the + # heap for objects. Decreased by major GC. + # * :oldmalloc_increase_bytes_limit: When + # :oldmalloc_increase_bytes crosses this limit, major GC is # triggered. - # * `:oldmalloc_increase_bytes`: Amount of memory allocated on the heap for - # objects. Decreased by major GC. - # * `:oldmalloc_increase_bytes_limit`: When `:oldmalloc_increase_bytes` - # crosses this limit, major GC is triggered. # def self.stat: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped] | (Symbol key) -> Integer @@ -575,21 +582,22 @@ module GC # # The statistics for a heap may include: # - # * `:slot_size`: The slot size of the heap in bytes. - # * `:heap_allocatable_pages`: The number of pages that can be allocated - # without triggering a new garbage collection cycle. - # * `:heap_eden_pages`: The number of pages in the eden heap. - # * `:heap_eden_slots`: The total number of slots in all of the pages in the - # eden heap. - # * `:total_allocated_pages`: The total number of pages that have been - # allocated in the heap. - # * `:total_freed_pages`: The total number of pages that have been freed and - # released back to the system in the heap. - # * `:force_major_gc_count`: The number of times this heap has forced major - # garbage collection cycles to start due to running out of free slots. - # * `:force_incremental_marking_finish_count`: The number of times this heap - # has forced incremental marking to complete due to running out of pooled + # * :slot_size: The slot size of the heap in bytes. + # * :heap_allocatable_pages: The number of pages that can be + # allocated without triggering a new garbage collection cycle. + # * :heap_eden_pages: The number of pages in the eden heap. + # * :heap_eden_slots: The total number of slots in all of the + # pages in the eden heap. + # * :total_allocated_pages: The total number of pages that have + # been allocated in the heap. + # * :total_freed_pages: The total number of pages that have been + # freed and released back to the system in the heap. + # * :force_major_gc_count: The number of times this heap has + # forced major garbage collection cycles to start due to running out of free # slots. + # * :force_incremental_marking_finish_count: The number of times + # this heap has forced incremental marking to complete due to running out of + # pooled slots. # def self.stat_heap: (?Integer? heap_name, ?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped] | (Integer heap_name, Symbol key) -> Integer diff --git a/core/hash.rbs b/core/hash.rbs index 9543b0fe6..4061f7745 100644 --- a/core/hash.rbs +++ b/core/hash.rbs @@ -8,7 +8,7 @@ # # ### Hash Data Syntax # -# The original syntax for a hash entry uses the "hash rocket," `=>`: +# The original syntax for a hash entry uses the "hash rocket," =>: # # h = {:foo => 0, :bar => 1, :baz => 2} # h # => {foo: 0, bar: 1, baz: 2} @@ -165,7 +165,7 @@ # #### `Hash` Key Equivalence # # Two objects are treated as the same hash key when their `hash` value is -# identical and the two objects are `eql?` to each other. +# identical and the two objects are eql? to each other. # # #### Modifying an Active `Hash` Key # @@ -180,7 +180,7 @@ # h[a0] # => 0 # a0.hash # => 110002110 # -# Modifying array element `a0[0]` changes its hash value: +# Modifying array element a0[0] changes its hash value: # # a0[0] = :bam # a0.hash # => 1069447059 @@ -208,17 +208,17 @@ # #### User-Defined `Hash` Keys # # To be usable as a `Hash` key, objects must implement the methods `hash` and -# `eql?`. Note: this requirement does not apply if the `Hash` uses +# eql?. Note: this requirement does not apply if the `Hash` uses # #compare_by_identity since comparison will then rely on the keys' object id -# instead of `hash` and `eql?`. +# instead of `hash` and eql?. # -# Object defines basic implementation for `hash` and `eq?` that makes each -# object a distinct key. Typically, user-defined classes will want to override -# these methods to provide meaningful behavior, or for example inherit Struct -# that has useful definitions for these. +# Object defines basic implementation for `hash` and eq? that makes +# each object a distinct key. Typically, user-defined classes will want to +# override these methods to provide meaningful behavior, or for example inherit +# Struct that has useful definitions for these. # -# A typical implementation of `hash` is based on the object's data while `eql?` -# is usually aliased to the overridden `==` method: +# A typical implementation of `hash` is based on the object's data while +# eql? is usually aliased to the overridden == method: # # class Book # attr_reader :author, :title @@ -263,7 +263,7 @@ # # If you want `nil` returned for a not-found key, you can call: # -# * #[](key) (usually written as `#[key]`. +# * #[](key) (usually written as #[key]. # * #assoc(key). # * #dig(key, *identifiers). # * #values_at(*keys). @@ -524,10 +524,12 @@ class Hash[unchecked out K, unchecked out V] < Object # --> # If `object` is a hash, returns `object`. # - # Otherwise if `object` responds to `:to_hash`, calls `object.to_hash`; returns - # the result if it is a hash, or raises TypeError if not. + # Otherwise if `object` responds to :to_hash, calls + # object.to_hash; returns the result if it is a hash, or raises + # TypeError if not. # - # Otherwise if `object` does not respond to `:to_hash`, returns `nil`. + # Otherwise if `object` does not respond to :to_hash, returns + # `nil`. # def self.try_convert: [U, V] (_ToHash[U, V]) -> ::Hash[U, V] | (untyped) -> (::Hash[untyped, untyped] | nil) @@ -587,7 +589,7 @@ class Hash[unchecked out K, unchecked out V] < Object # # * `object` is a `Hash` object (or can be converted to one). # * `self` and `object` have the same keys (regardless of order). - # * For each key `key`, `self[key] == object[key]`. + # * For each key `key`, self[key] == object[key]. # # Otherwise, returns `false`. # @@ -716,7 +718,7 @@ class Hash[unchecked out K, unchecked out V] < Object # otherwise. # # With argument `entry` and no block, returns `true` if for any key `key` - # `self.assoc(key) == entry`, `false` otherwise: + # self.assoc(key) == entry, `false` otherwise: # # h = {foo: 0, bar: 1, baz: 2} # h.assoc(:bar) # => [:bar, 1] @@ -1103,7 +1105,7 @@ class Hash[unchecked out K, unchecked out V] < Object # # * The given `object` is a `Hash` object. # * `self` and `object` have the same keys (regardless of order). - # * For each key `key`, `self[key].eql?(object[key])`. + # * For each key `key`, self[key].eql?(object[key]). # # Otherwise, returns `false`. # @@ -1232,7 +1234,8 @@ class Hash[unchecked out K, unchecked out V] < Object # * Each element whose value is not an array is unchanged. even if the value # is an object that has instance method flatten (such as a hash). # - # Examples; note that entry `foo: {bar: 1, baz: 2}` is never flattened. + # Examples; note that entry foo: {bar: 1, baz: 2} is never + # flattened. # # h = {foo: {bar: 1, baz: 2}, bat: [:bam, [:bap, [:bah]]]} # h.flatten(1) # => [:foo, {:bar=>1, :baz=>2}, :bat, [:bam, [:bap, [:bah]]]] @@ -1475,8 +1478,8 @@ class Hash[unchecked out K, unchecked out V] < Object # With no block given, for each successive entry `key`/`new_value` in each # successive `other_hash`: # - # * If `key` is in `self`, sets `self[key] = new_value`, whose position is - # unchanged: + # * If `key` is in `self`, sets self[key] = new_value, whose + # position is unchanged: # # h0 = {foo: 0, bar: 1, baz: 2} # h1 = {bar: 3, foo: -1} @@ -1490,9 +1493,9 @@ class Hash[unchecked out K, unchecked out V] < Object # With a block given, for each successive entry `key`/`new_value` in each # successive `other_hash`: # - # * If `key` is in `self`, fetches `old_value` from `self[key]`, calls the - # block with `key`, `old_value`, and `new_value`, and sets `self[key] = - # new_value`, whose position is unchanged : + # * If `key` is in `self`, fetches `old_value` from self[key], + # calls the block with `key`, `old_value`, and `new_value`, and sets + # self[key] = new_value, whose position is unchanged : # # season = {AB: 75, H: 20, HR: 3, SO: 17, W: 11, HBP: 3} # today = {AB: 3, H: 1, W: 1} @@ -1515,8 +1518,8 @@ class Hash[unchecked out K, unchecked out V] < Object # rdoc-file=hash.c # - rassoc(value) -> new_array or nil # --> - # Searches `self` for the first entry whose value is `==` to the given `value`; - # see [Entry Order](rdoc-ref:Hash@Entry+Order). + # Searches `self` for the first entry whose value is == to the + # given `value`; see [Entry Order](rdoc-ref:Hash@Entry+Order). # # If the entry is found, returns its key and value as a 2-element array; returns # `nil` if not found: @@ -1796,9 +1799,9 @@ class Hash[unchecked out K, unchecked out V] < Object # With a block given and no argument, `new_hash` has keys determined only by the # block. # - # For each key/value pair `old_key/value` in `self`, calls the block with - # `old_key`; the block's return value becomes `new_key`; sets `new_hash[new_key] - # = value`; a duplicate key overwrites: + # For each key/value pair old_key/value in `self`, calls the block + # with `old_key`; the block's return value becomes `new_key`; sets + # new_hash[new_key] = value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys {|old_key| old_key.to_s } @@ -1809,11 +1812,12 @@ class Hash[unchecked out K, unchecked out V] < Object # With argument `other_hash` given and no block, `new_hash` may have new keys # provided by `other_hash` and unchanged keys provided by `self`. # - # For each key/value pair `old_key/old_value` in `self`, looks for key `old_key` - # in `other_hash`: + # For each key/value pair old_key/old_value in `self`, looks for + # key `old_key` in `other_hash`: # - # * If `old_key` is found, its value `other_hash[old_key]` is taken as - # `new_key`; sets `new_hash[new_key] = value`; a duplicate key overwrites: + # * If `old_key` is found, its value other_hash[old_key] is taken + # as `new_key`; sets new_hash[new_key] = value; a duplicate key + # overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys(baz: :BAZ, bar: :BAR, foo: :FOO) @@ -1821,8 +1825,8 @@ class Hash[unchecked out K, unchecked out V] < Object # h.transform_keys(baz: :FOO, bar: :FOO, foo: :FOO) # # => {FOO: 2} # - # * If `old_key` is not found, sets `new_hash[old_key] = value`; a duplicate - # key overwrites: + # * If `old_key` is not found, sets new_hash[old_key] = value; a + # duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys({}) @@ -1843,16 +1847,16 @@ class Hash[unchecked out K, unchecked out V] < Object # For each pair `old_key` and `value` in `self`: # # * If `other_hash` has key `old_key` (with value `new_key`), does not call - # the block for that key; sets `new_hash[new_key] = value`; a duplicate key - # overwrites: + # the block for that key; sets new_hash[new_key] = value; a + # duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys(baz: :BAZ, bar: :BAR, foo: :FOO) {|key| fail 'Not called' } # # => {FOO: 0, BAR: 1, BAZ: 2} # # * If `other_hash` does not have key `old_key`, calls the block with - # `old_key` and takes its return value as `new_key`; sets `new_hash[new_key] - # = value`; a duplicate key overwrites: + # `old_key` and takes its return value as `new_key`; sets + # new_hash[new_key] = value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys(baz: :BAZ) {|key| key.to_s.reverse } @@ -1881,10 +1885,10 @@ class Hash[unchecked out K, unchecked out V] < Object # With a block given and no argument, derives keys only from the block; all, # some, or none of the keys in `self` may be changed. # - # For each key/value pair `old_key/value` in `self`, calls the block with - # `old_key`; the block's return value becomes `new_key`; removes the entry for - # `old_key`: `self.delete(old_key)`; sets `self[new_key] = value`; a duplicate - # key overwrites: + # For each key/value pair old_key/value in `self`, calls the block + # with `old_key`; the block's return value becomes `new_key`; removes the entry + # for `old_key`: self.delete(old_key); sets self[new_key] = + # value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys! {|old_key| old_key.to_s } @@ -1897,12 +1901,13 @@ class Hash[unchecked out K, unchecked out V] < Object # `other_hash` and `self`; all, some, or none of the keys in `self` may be # changed. # - # For each key/value pair `old_key/old_value` in `self`, looks for key `old_key` - # in `other_hash`: + # For each key/value pair old_key/old_value in `self`, looks for + # key `old_key` in `other_hash`: # - # * If `old_key` is found, takes value `other_hash[old_key]` as `new_key`; - # removes the entry for `old_key`: `self.delete(old_key)`; sets - # `self[new_key] = value`; a duplicate key overwrites: + # * If `old_key` is found, takes value other_hash[old_key] as + # `new_key`; removes the entry for `old_key`: + # self.delete(old_key); sets self[new_key] = + # value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys!(baz: :BAZ, bar: :BAR, foo: :FOO) @@ -1933,8 +1938,8 @@ class Hash[unchecked out K, unchecked out V] < Object # # * If `other_hash` has key `old_key` (with value `new_key`), does not call # the block for that key; removes the entry for `old_key`: - # `self.delete(old_key)`; sets `self[new_key] = value`; a duplicate key - # overwrites: + # self.delete(old_key); sets self[new_key] = + # value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys!(baz: :BAZ, bar: :BAR, foo: :FOO) {|key| fail 'Not called' } @@ -1942,8 +1947,8 @@ class Hash[unchecked out K, unchecked out V] < Object # # * If `other_hash` does not have key `old_key`, calls the block with # `old_key` and takes its return value as `new_key`; removes the entry for - # `old_key`: `self.delete(old_key)`; sets `self[new_key] = value`; a - # duplicate key overwrites: + # `old_key`: self.delete(old_key); sets self[new_key] = + # value; a duplicate key overwrites: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_keys!(baz: :BAZ) {|key| key.to_s.reverse } @@ -1990,7 +1995,8 @@ class Hash[unchecked out K, unchecked out V] < Object # returns `self`. # # For each entry `key`/`old_value` in `self`, calls the block with `old_value`, - # captures its return value as `new_value`, and sets `self[key] = new_value`: + # captures its return value as `new_value`, and sets self[key] = + # new_value: # # h = {foo: 0, bar: 1, baz: 2} # h.transform_values! {|value| value * 100} # => {foo: 0, bar: 100, baz: 200} @@ -2015,8 +2021,8 @@ class Hash[unchecked out K, unchecked out V] < Object # With no block given, for each successive entry `key`/`new_value` in each # successive `other_hash`: # - # * If `key` is in `self`, sets `self[key] = new_value`, whose position is - # unchanged: + # * If `key` is in `self`, sets self[key] = new_value, whose + # position is unchanged: # # h0 = {foo: 0, bar: 1, baz: 2} # h1 = {bar: 3, foo: -1} @@ -2030,9 +2036,9 @@ class Hash[unchecked out K, unchecked out V] < Object # With a block given, for each successive entry `key`/`new_value` in each # successive `other_hash`: # - # * If `key` is in `self`, fetches `old_value` from `self[key]`, calls the - # block with `key`, `old_value`, and `new_value`, and sets `self[key] = - # new_value`, whose position is unchanged : + # * If `key` is in `self`, fetches `old_value` from self[key], + # calls the block with `key`, `old_value`, and `new_value`, and sets + # self[key] = new_value, whose position is unchanged : # # season = {AB: 75, H: 20, HR: 3, SO: 17, W: 11, HBP: 3} # today = {AB: 3, H: 1, W: 1} diff --git a/core/integer.rbs b/core/integer.rbs index e1536f5c3..fd2ef0ae4 100644 --- a/core/integer.rbs +++ b/core/integer.rbs @@ -88,7 +88,7 @@ # * #downto: Calls the given block with each integer value from `self` down to # the given value. # * #times: Calls the given block `self` times with each integer in -# `(0..self-1)`. +# (0..self-1). # * #upto: Calls the given block with each integer value from `self` up to the # given value. # @@ -114,9 +114,9 @@ class Integer < Numeric # Integer.sqrt(4.0) # => 2 # Integer.sqrt(3.14159) # => 1 # - # This method is equivalent to `Math.sqrt(numeric).floor`, except that the - # result of the latter code may differ from the true value due to the limited - # precision of floating point arithmetic. + # This method is equivalent to Math.sqrt(numeric).floor, except + # that the result of the latter code may differ from the true value due to the + # limited precision of floating point arithmetic. # # Integer.sqrt(10**46) # => 100000000000000000000000 # Math.sqrt(10**46).floor # => 99999999999999991611392 @@ -132,14 +132,15 @@ class Integer < Numeric # If `object` is an Integer object, returns `object`. # Integer.try_convert(1) # => 1 # - # Otherwise if `object` responds to `:to_int`, calls `object.to_int` and returns - # the result. + # Otherwise if `object` responds to :to_int, calls + # object.to_int and returns the result. # Integer.try_convert(1.25) # => 1 # - # Returns `nil` if `object` does not respond to `:to_int` + # Returns `nil` if `object` does not respond to :to_int # Integer.try_convert([]) # => nil # - # Raises an exception unless `object.to_int` returns an Integer object. + # Raises an exception unless object.to_int returns an Integer + # object. # def self.try_convert: (int) -> Integer | (untyped) -> Integer? @@ -391,7 +392,7 @@ class Integer < Numeric # # Returns: # - # * `-1`, if `self` is less than `other`. + # * -1, if `self` is less than `other`. # * `0`, if `self` is equal to `other`. # * `1`, if `self` is greater then `other`. # * `nil`, if `self` and `other` are incomparable. @@ -502,8 +503,8 @@ class Integer < Numeric # n[2] # => 0 # n[3] # => 0 # - # In principle, `n[i]` is equivalent to `(n >> i) & 1`. Thus, negative index - # always returns zero: + # In principle, n[i] is equivalent to (n >> i) & 1. + # Thus, negative index always returns zero: # # 255[-1] # => 0 # @@ -514,8 +515,9 @@ class Integer < Numeric # "%010b" % n[0, 10] # => "0000111000" # "%010b" % n[4, 10] # => "0000000011" # - # With argument `range`, returns `range.size` bits from `self`, beginning at - # `range.begin` and including bits of greater significance: + # With argument `range`, returns range.size bits from `self`, + # beginning at range.begin and including bits of greater + # significance: # # n = 0b111000 # => 56 # "%010b" % n[0..9] # => "0000111000" @@ -611,7 +613,7 @@ class Integer < Numeric # significant bit has bit position 1). If there is no such bit (zero or minus # one), returns zero. # - # This method returns `ceil(log2(self < 0 ? -self : self + 1))`>. + # This method returns ceil(log2(self < 0 ? -self : self + 1))>. # # (-2**1000-1).bit_length # => 1001 # (-2**1000).bit_length # => 1000 @@ -664,7 +666,7 @@ class Integer < Numeric # # * When `self` is non-zero and `ndigits` is negative, # returns a value based on a computed granularity: - # * The granularity is `10 ** ndigits.abs`. + # * The granularity is 10 ** ndigits.abs. # * The returned value is the smallest multiple of the granularity # that is greater than or equal to `self`. # Examples with positive `self`: @@ -786,7 +788,7 @@ class Integer < Numeric # rdoc-file=numeric.c # - divmod(other) -> array # --> - # Returns a 2-element array `[q, r]`, where + # Returns a 2-element array [q, r], where # # q = (self/other).floor # Quotient # r = self % other # Remainder @@ -875,7 +877,7 @@ class Integer < Numeric # # * When `self` is non-zero and `ndigits` is negative, # returns a value based on a computed granularity: - # * The granularity is `10 ** ndigits.abs`. + # * The granularity is 10 ** ndigits.abs. # * The returned value is the largest multiple of the granularity # that is less than or equal to `self`. # Examples with positive `self`: @@ -1000,7 +1002,7 @@ class Integer < Numeric def negative?: () -> bool # - # Returns the successor integer of `self` (equivalent to `self + 1`): + # Returns the successor integer of `self` (equivalent to self + 1): # # 1.succ #=> 2 # -1.succ #=> 0 @@ -1080,7 +1082,7 @@ class Integer < Numeric # rdoc-file=numeric.c # - pred -> next_integer # --> - # Returns the predecessor of `self` (equivalent to `self - 1`): + # Returns the predecessor of `self` (equivalent to self - 1): # # 1.pred #=> 0 # -1.pred #=> -2 @@ -1139,8 +1141,8 @@ class Integer < Numeric # Returns `self` rounded to the nearest value with a precision of `ndigits` # decimal digits. # - # When `ndigits` is negative, the returned value has at least `ndigits.abs` - # trailing zeros: + # When `ndigits` is negative, the returned value has at least + # ndigits.abs trailing zeros: # # 555.round(-1) # => 560 # 555.round(-2) # => 600 @@ -1157,17 +1159,18 @@ class Integer < Numeric # If keyword argument `half` is given, and `self` is equidistant from the two # candidate values, the rounding is according to the given `half` value: # - # * `:up` or `nil`: round away from zero: + # * :up or `nil`: round away from zero: # # 25.round(-1, half: :up) # => 30 # (-25).round(-1, half: :up) # => -30 # - # * `:down`: round toward zero: + # * :down: round toward zero: # # 25.round(-1, half: :down) # => 20 # (-25).round(-1, half: :down) # => -20 # - # * `:even`: round toward the candidate whose last nonzero digit is even: + # * :even: round toward the candidate whose last nonzero digit is + # even: # # 25.round(-1, half: :even) # => 20 # 15.round(-1, half: :even) # => 20 @@ -1200,7 +1203,7 @@ class Integer < Numeric # rdoc-file=numeric.c # - succ -> next_integer # --> - # Returns the successor integer of `self` (equivalent to `self + 1`): + # Returns the successor integer of `self` (equivalent to self + 1): # # 1.succ #=> 2 # -1.succ #=> 0 @@ -1214,7 +1217,8 @@ class Integer < Numeric # - times {|i| ... } -> self # - times -> enumerator # --> - # Calls the given block `self` times with each integer in `(0..self-1)`: + # Calls the given block `self` times with each integer in + # (0..self-1): # # a = [] # 5.times {|i| a.push(i) } # => 5 @@ -1330,8 +1334,8 @@ class Integer < Numeric # Returns `self` truncated (toward zero) to a precision of `ndigits` decimal # digits. # - # When `ndigits` is negative, the returned value has at least `ndigits.abs` - # trailing zeros: + # When `ndigits` is negative, the returned value has at least + # ndigits.abs trailing zeros: # # 555.truncate(-1) # => 550 # 555.truncate(-2) # => 500 diff --git a/core/io.rbs b/core/io.rbs index b0e15177e..96f82c1af 100644 --- a/core/io.rbs +++ b/core/io.rbs @@ -7,9 +7,9 @@ # classes in the Ruby standard library are also subclasses of IO; these include # TCPSocket and UDPSocket. # -# The global constant ARGF (also accessible as `$<`) provides an IO-like stream -# that allows access to all file paths found in ARGV (or found in STDIN if ARGV -# is empty). ARGF is not itself a subclass of IO. +# The global constant ARGF (also accessible as $<) provides an +# IO-like stream that allows access to all file paths found in ARGV (or found in +# STDIN if ARGV is empty). ARGF is not itself a subclass of IO. # # Class StringIO provides an IO-like stream that handles a String. StringIO is # not itself a subclass of IO. @@ -46,10 +46,10 @@ # from the position mentioned above); see [Line # Number](rdoc-ref:IO@Line+Number). # -# ## Extension `io/console` +# ## Extension io/console # -# Extension `io/console` provides numerous methods for interacting with the -# console; requiring it adds numerous methods to class IO. +# Extension io/console provides numerous methods for interacting +# with the console; requiring it adds numerous methods to class IO. # # ## Example Files # @@ -86,23 +86,23 @@ # A number of IO methods accept optional keyword arguments that determine how a # new stream is to be opened: # -# * `:mode`: Stream mode. -# * `:flags`: Integer file open flags; If `mode` is also given, the two are -# bitwise-ORed. -# * `:external_encoding`: External encoding for the stream. -# * `:internal_encoding`: Internal encoding for the stream. `'-'` is a synonym -# for the default internal encoding. If the value is `nil` no conversion -# occurs. -# * `:encoding`: Specifies external and internal encodings as -# `'extern:intern'`. -# * `:textmode`: If a truthy value, specifies the mode as text-only, binary -# otherwise. -# * `:binmode`: If a truthy value, specifies the mode as binary, text-only -# otherwise. -# * `:autoclose`: If a truthy value, specifies that the `fd` will close when -# the stream closes; otherwise it remains open. -# * `:path:` If a string value is provided, it is used in #inspect and is -# available as #path method. +# * :mode: Stream mode. +# * :flags: Integer file open flags; If `mode` is also given, the +# two are bitwise-ORed. +# * :external_encoding: External encoding for the stream. +# * :internal_encoding: Internal encoding for the stream. +# '-' is a synonym for the default internal encoding. If the +# value is `nil` no conversion occurs. +# * :encoding: Specifies external and internal encodings as +# 'extern:intern'. +# * :textmode: If a truthy value, specifies the mode as +# text-only, binary otherwise. +# * :binmode: If a truthy value, specifies the mode as binary, +# text-only otherwise. +# * :autoclose: If a truthy value, specifies that the `fd` will +# close when the stream closes; otherwise it remains open. +# * :path: If a string value is provided, it is used in #inspect +# and is available as #path method. # # Also available are the options offered in String#encode, which may control # conversion between external and internal encoding. @@ -129,8 +129,8 @@ # # The relevant methods: # -# * IO#tell (aliased as `#pos`): Returns the current position (in bytes) in -# the stream. +# * IO#tell (aliased as #pos): Returns the current position (in +# bytes) in the stream. # * IO#pos=: Sets the position of the stream to a given integer `new_position` # (in bytes). # * IO#seek: Sets the position of the stream to a given integer `offset` (in @@ -158,8 +158,8 @@ # # You can query whether a stream is positioned at its end: # -# * IO#eof? (also aliased as `#eof`): Returns whether the stream is at -# end-of-stream. +# * IO#eof? (also aliased as #eof): Returns whether the stream is +# at end-of-stream. # # You can reposition to end-of-stream by using method IO#seek: # @@ -225,8 +225,8 @@ # separator*: the string that determines what is considered a line; it is # sometimes called the *input record separator*. # -# The default line separator is taken from global variable `$/`, whose initial -# value is `"\n"`. +# The default line separator is taken from global variable $/, +# whose initial value is "\n". # # Generally, the line to be read next is all data from the current # [position](rdoc-ref:IO@Position) to the next line separator (but see [Special @@ -250,7 +250,7 @@ # f.gets # => "e\n" # f.close # -# Or by setting global variable `$/`: +# Or by setting global variable $/: # # f = File.new('t.txt') # $/ = 'l' @@ -270,8 +270,8 @@ # f.gets(nil) # => "First line\nSecond line\n\nFourth line\nFifth line\n" # f.close # -# * `''` (the empty string): The next "paragraph" is to be read (paragraphs -# being separated by two consecutive line separators): +# * '' (the empty string): The next "paragraph" is to be read +# (paragraphs being separated by two consecutive line separators): # # f = File.new('t.txt') # f.gets('') # => "First line\nSecond line\n\n" @@ -285,8 +285,8 @@ # multi-byte character will not be split, and so a returned line may be slightly # longer than the limit). # -# The default limit value is `-1`; any negative limit value means that there is -# no limit. +# The default limit value is -1; any negative limit value means +# that there is no limit. # # If there is no limit, the line is determined only by `sep`. # @@ -385,10 +385,10 @@ # f.lineno # => 1001 # f.close # -# Associated with the line number is the global variable `$.`: +# Associated with the line number is the global variable $.: # -# * When a stream is opened, `$.` is not set; its value is left over from -# previous activity in the process: +# * When a stream is opened, $. is not set; its value is left +# over from previous activity in the process: # # $. = 41 # f = File.new('t.txt') @@ -396,7 +396,8 @@ # # => 41 # f.close # -# * When a stream is read, `$.` is set to the line number for that stream: +# * When a stream is read, $. is set to the line number for that +# stream: # # f0 = File.new('t.txt') # f1 = File.new('t.dat') @@ -407,7 +408,7 @@ # f0.close # f1.close # -# * Methods IO#rewind and IO#seek do not affect `$.`: +# * Methods IO#rewind and IO#seek do not affect $.: # # f = File.new('t.txt') # f.readlines # => ["First line\n", "Second line\n", "\n", "Fourth line\n", "Fifth line\n"] @@ -652,15 +653,17 @@ class IO < Object # # Argument `advice` is one of the following symbols: # - # * `:normal`: The application has no advice to give about its access pattern - # for the specified data. If no advice is given for an open file, this is - # the default assumption. - # * `:sequential`: The application expects to access the specified data - # sequentially (with lower offsets read before higher ones). - # * `:random`: The specified data will be accessed in random order. - # * `:noreuse`: The specified data will be accessed only once. - # * `:willneed`: The specified data will be accessed in the near future. - # * `:dontneed`: The specified data will not be accessed in the near future. + # * :normal: The application has no advice to give about its + # access pattern for the specified data. If no advice is given for an open + # file, this is the default assumption. + # * :sequential: The application expects to access the specified + # data sequentially (with lower offsets read before higher ones). + # * :random: The specified data will be accessed in random order. + # * :noreuse: The specified data will be accessed only once. + # * :willneed: The specified data will be accessed in the near + # future. + # * :dontneed: The specified data will not be accessed in the + # near future. # # Not implemented on all platforms. # @@ -724,8 +727,8 @@ class IO < Object # If the stream is open for writing, flushes any buffered writes to the # operating system before closing. # - # If the stream was opened by IO.popen, sets global variable `$?` (child exit - # status). + # If the stream was opened by IO.popen, sets global variable $? + # (child exit status). # # It is not an error to close an IO object that has already been closed. It just # returns nil. @@ -790,7 +793,7 @@ class IO < Object # and Closed Streams](rdoc-ref:IO@Open+and+Closed+Streams). # # If the stream was opened by IO.popen and is also closed for writing, sets - # global variable `$?` (child exit status). + # global variable $? (child exit status). # # Example: # @@ -824,7 +827,7 @@ class IO < Object # Flushes any buffered writes to the operating system before closing. # # If the stream was opened by IO.popen and is also closed for reading, sets - # global variable `$?` (child exit status). + # global variable $? (child exit status). # # IO.popen('ruby', 'r+') do |pipe| # puts pipe.closed? @@ -990,8 +993,8 @@ class IO < Object # - fdatasync -> 0 # --> # Immediately writes to disk all data buffered in the stream, via the operating - # system's: `fdatasync(2)`, if supported, otherwise via `fsync(2)`, if - # supported; otherwise raises an exception. + # system's: fdatasync(2), if supported, otherwise via + # fsync(2), if supported; otherwise raises an exception. # def fdatasync: () -> Integer? @@ -1026,7 +1029,7 @@ class IO < Object # - fsync -> 0 # --> # Immediately writes to disk all data buffered in the stream, via the operating - # system's `fsync(2)`. + # system's fsync(2). # # Note this difference: # @@ -1036,7 +1039,8 @@ class IO < Object # * IO#fsync: Ensures both that data is flushed from internal buffers, and # that data is written to disk. # - # Raises an exception if the operating system does not support `fsync(2)`. + # Raises an exception if the operating system does not support + # fsync(2). # def fsync: () -> Integer? @@ -1082,11 +1086,11 @@ class IO < Object # - gets(limit, chomp: false) -> string or nil # - gets(sep, limit, chomp: false) -> string or nil # --> - # Reads and returns a line from the stream; assigns the return value to `$_`. - # See [Line IO](rdoc-ref:IO@Line+IO). + # Reads and returns a line from the stream; assigns the return value to + # $_. See [Line IO](rdoc-ref:IO@Line+IO). # # With no arguments given, returns the next line as determined by line separator - # `$/`, or `nil` if none: + # $/, or `nil` if none: # # f = File.open('t.txt') # f.gets # => "First line\n" @@ -1316,15 +1320,15 @@ class IO < Object # - print(*objects) -> nil # --> # Writes the given objects to the stream; returns `nil`. Appends the output - # record separator `$OUTPUT_RECORD_SEPARATOR` (`$\`), if it is not `nil`. See - # [Line IO](rdoc-ref:IO@Line+IO). + # record separator $OUTPUT_RECORD_SEPARATOR ($\), if + # it is not `nil`. See [Line IO](rdoc-ref:IO@Line+IO). # # With argument `objects` given, for each object: # # * Converts via its method `to_s` if not a string. # * Writes to the stream. # * If not the last object, writes the output field separator - # `$OUTPUT_FIELD_SEPARATOR` (`$,`) if it is not `nil`. + # $OUTPUT_FIELD_SEPARATOR ($,) if it is not `nil`. # # With default separators: # @@ -1356,8 +1360,8 @@ class IO < Object # # "0,0.0,0/1,0+0i,zero,zero\n" # - # With no argument given, writes the content of `$_` (which is usually the most - # recent user input): + # With no argument given, writes the content of $_ (which is + # usually the most recent user input): # # f = File.open('t.tmp', 'w+') # gets # Sets $_ to the most recent user input. @@ -1406,13 +1410,13 @@ class IO < Object # newline sequence. If called without arguments, writes a newline. See [Line # IO](rdoc-ref:IO@Line+IO). # - # Note that each added newline is the character `"\n", not the output - # record separator ($\`). + # Note that each added newline is the character "\n", not the output + # record separator ($\). # # Treatment for each object: # # * String: writes the string. - # * Neither string nor array: writes `object.to_s`. + # * Neither string nor array: writes object.to_s. # * Array: writes each element of the array; arrays may be nested. # # To keep these examples brief, we define this helper method: @@ -1519,7 +1523,7 @@ class IO < Object # * `out_string` given: encoding of `out_string` not modified. # * `out_string` not given: ASCII-8BIT is used. # - # **Without Argument `out_string`** + # Without Argument `out_string` # # When argument `out_string` is omitted, the returned value is a new string: # @@ -1534,7 +1538,7 @@ class IO < Object # # If `maxlen` is zero, returns an empty string. # - # ** With Argument `out_string`** + # With Argument `out_string` # # When argument `out_string` is given, the returned value is `out_string`, whose # content is replaced: @@ -1620,8 +1624,8 @@ class IO < Object # # By specifying a keyword argument *exception* to `false`, you can indicate that # read_nonblock should not raise an IO::WaitReadable exception, but return the - # symbol `:wait_readable` instead. At EOF, it will return nil instead of raising - # EOFError. + # symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. # def read_nonblock: (int len, ?string buf, ?exception: true) -> String | (int len, ?string buf, exception: false) -> (String | :wait_readable | nil) @@ -1681,11 +1685,11 @@ class IO < Object # - readlines(limit, chomp: false) -> array # - readlines(sep, limit, chomp: false) -> array # --> - # Reads and returns all remaining line from the stream; does not modify `$_`. - # See [Line IO](rdoc-ref:IO@Line+IO). + # Reads and returns all remaining line from the stream; does not modify + # $_. See [Line IO](rdoc-ref:IO@Line+IO). # - # With no arguments given, returns lines as determined by line separator `$/`, - # or `nil` if none: + # With no arguments given, returns lines as determined by line separator + # $/, or `nil` if none: # # f = File.new('t.txt') # f.readlines @@ -1891,8 +1895,8 @@ class IO < Object # Seeks to the position given by integer `offset` (see # [Position](rdoc-ref:IO@Position)) and constant `whence`, which is one of: # - # * `:CUR` or `IO::SEEK_CUR`: Repositions the stream to its current position - # plus the given `offset`: + # * :CUR or IO::SEEK_CUR: Repositions the stream to + # its current position plus the given `offset`: # # f = File.open('t.txt') # f.tell # => 0 @@ -1902,8 +1906,8 @@ class IO < Object # f.tell # => 10 # f.close # - # * `:END` or `IO::SEEK_END`: Repositions the stream to its end plus the given - # `offset`: + # * :END or IO::SEEK_END: Repositions the stream to + # its end plus the given `offset`: # # f = File.open('t.txt') # f.tell # => 0 @@ -1915,7 +1919,8 @@ class IO < Object # f.tell # => 12 # f.close # - # * `:SET` or `IO:SEEK_SET`: Repositions the stream to the given `offset`: + # * :SET or IO:SEEK_SET: Repositions the stream to + # the given `offset`: # # f = File.open('t.txt') # f.tell # => 0 @@ -1943,7 +1948,7 @@ class IO < Object # Argument `int_enc`, if given, must be an Encoding object or a String with the # encoding name; it is assigned as the encoding for the internal string. # - # Argument `'ext_enc:int_enc'`, if given, is a string containing two + # Argument 'ext_enc:int_enc', if given, is a string containing two # colon-separated encoding names; corresponding Encoding objects are assigned as # the external and internal encodings for the stream. # @@ -2313,11 +2318,11 @@ class IO < Object # # On some platforms such as Windows, write_nonblock is not supported according # to the kind of the IO object. In such cases, write_nonblock raises - # `Errno::EBADF`. + # Errno::EBADF. # # By specifying a keyword argument *exception* to `false`, you can indicate that # write_nonblock should not raise an IO::WaitWritable exception, but return the - # symbol `:wait_writable` instead. + # symbol :wait_writable instead. # def write_nonblock: (_ToS s, ?exception: true) -> Integer | (_ToS s, exception: false) -> (Integer | :wait_writable | nil) @@ -2351,15 +2356,15 @@ class IO < Object # # * The path to a readable file, from which source data is to be read. # * An IO-like object, opened for reading and capable of responding to - # method `:readpartial` or method `:read`. + # method :readpartial or method :read. # # * The given `dst` must be one of the following: # # * The path to a writable file, to which data is to be written. # * An IO-like object, opened for writing and capable of responding to - # method `:write`. + # method :write. # - # The examples here use file `t.txt` as source: + # The examples here use file t.txt as source: # # File.read('t.txt') # # => "First line\nSecond line\n\nThird line\nFourth line\n" @@ -2409,8 +2414,8 @@ class IO < Object # # If a block is given, the stream is passed to the block (again, open for # reading, writing, or both); when the block exits, the stream is closed, the - # block's value is returned, and the global variable `$?` is set to the child's - # exit status. + # block's value is returned, and the global variable $? is set to + # the child's exit status. # # Optional argument `mode` may be any valid IO mode. See [Access # Modes](rdoc-ref:File@Access+Modes). @@ -2441,8 +2446,8 @@ class IO < Object # # **Forked Process** # - # When argument `cmd` is the 1-character string `'-'`, causes the process to - # fork: + # When argument `cmd` is the 1-character string '-', causes the + # process to fork: # IO.popen('-') do |pipe| # if pipe # $stderr.puts "In parent, child pid is #{pipe.pid}\n" @@ -2460,8 +2465,8 @@ class IO < Object # # **Shell Subprocess** # - # When argument `cmd` is a single string (but not `'-'`), the program named - # `cmd` is run as a shell command: + # When argument `cmd` is a single string (but not '-'), the program + # named `cmd` is run as a shell command: # # IO.popen('uname') do |pipe| # pipe.readlines @@ -2485,8 +2490,8 @@ class IO < Object # # **Program Subprocess** # - # When argument `cmd` is an array of strings, the program named `cmd[0]` is run - # with all elements of `cmd` as its arguments: + # When argument `cmd` is an array of strings, the program named + # cmd[0] is run with all elements of `cmd` as its arguments: # # IO.popen(['du', '..', '.']) do |pipe| # $stderr.puts pipe.readlines.size @@ -2496,18 +2501,19 @@ class IO < Object # # 1111 # - # **Program Subprocess with `argv0`** + # Program Subprocess with `argv0` # # When argument `cmd` is an array whose first element is a 2-element string # array and whose remaining elements (if any) are strings: # - # * `cmd[0][0]` (the first string in the nested array) is the name of a - # program that is run. - # * `cmd[0][1]` (the second string in the nested array) is set as the - # program's `argv[0]`. - # * `cmd[1..-1]` (the strings in the outer array) are the program's arguments. + # * cmd[0][0] (the first string in the nested array) is the name + # of a program that is run. + # * cmd[0][1] (the second string in the nested array) is set as + # the program's argv[0]. + # * cmd[1..-1] (the strings in the outer array) are the program's + # arguments. # - # Example (sets `$0` to 'foo'): + # Example (sets $0 to 'foo'): # # IO.popen([['/bin/sh', 'foo'], '-c', 'echo $0']).read # => "foo\n" # @@ -2695,8 +2701,8 @@ class IO < Object # In the example below, the two processes close the ends of the pipe that they # are not using. This is not just a cosmetic nicety. The read end of a pipe will # not generate an end of file condition if there are any writers with the pipe - # still open. In the case of the parent process, the `rd.read` will never return - # if it does not first issue a `wr.close`: + # still open. In the case of the parent process, the rd.read will + # never return if it does not first issue a wr.close: # # rd, wr = IO.pipe # @@ -2712,7 +2718,7 @@ class IO < Object # wr.close # end # - # *produces:* + # produces: # # Sending message to parent # Parent got: @@ -2821,8 +2827,9 @@ class IO < Object # IO objects. # # Argument `timeout` is a numeric value (such as integer or float) timeout - # interval in seconds. `timeout` can also be `nil` or `Float::INFINITY`. `nil` - # and `Float::INFINITY` means no timeout. + # interval in seconds. `timeout` can also be `nil` or + # Float::INFINITY. `nil` and Float::INFINITY means no + # timeout. # # The method monitors the IO objects given in all three arrays, waiting for some # to be ready; returns a 3-element array whose elements are: @@ -2897,8 +2904,8 @@ class IO < Object # # The writability notified by select(2) doesn't show how many bytes are # writable. IO#write method blocks until given whole string is written. So, - # `IO#write(two or more bytes)` can block after writability is notified by - # IO.select. IO#write_nonblock is required to avoid the blocking. + # IO#write(two or more bytes) can block after writability is + # notified by IO.select. IO#write_nonblock is required to avoid the blocking. # # Blocking write (#write) can be emulated using #write_nonblock and IO.select as # follows: IO::WaitReadable should also be rescued for SSL renegotiation in @@ -3009,7 +3016,7 @@ class IO < Object # File.read('t.tmp') # => "ab012f" # # If `offset` is outside the file content, the file is padded with null - # characters `"\u0000"`: + # characters "\u0000": # # IO.write('t.tmp', 'xyz', 10) # => 3 # File.read('t.tmp') # => "ab012f\u0000\u0000\u0000\u0000xyz" @@ -3048,7 +3055,8 @@ class IO < Object # Calls the block with each remaining line read from the stream; returns `self`. # Does nothing if already at end-of-stream; See [Line IO](rdoc-ref:IO@Line+IO). # - # With no arguments given, reads lines as determined by line separator `$/`: + # With no arguments given, reads lines as determined by line separator + # $/: # # f = File.new('t.txt') # f.each_line {|line| p line } @@ -3150,7 +3158,8 @@ class IO < Object # Calls the block with each remaining line read from the stream; returns `self`. # Does nothing if already at end-of-stream; See [Line IO](rdoc-ref:IO@Line+IO). # - # With no arguments given, reads lines as determined by line separator `$/`: + # With no arguments given, reads lines as determined by line separator + # $/: # # f = File.new('t.txt') # f.each_line {|line| p line } diff --git a/core/io/buffer.rbs b/core/io/buffer.rbs index a73b35f86..08245dd24 100644 --- a/core/io/buffer.rbs +++ b/core/io/buffer.rbs @@ -81,9 +81,9 @@ class IO # File.read('test.txt') # # => "t--- data" # - # **The class is experimental and the interface is subject to change, this is - # especially true of file mappings which may be removed entirely in the - # future.** + # The class is experimental and the interface is subject to change, this + # is especially true of file mappings which may be removed entirely in the + # future. # class Buffer include Comparable @@ -356,7 +356,7 @@ class IO # - get_string([offset, [length, [encoding]]]) -> string # --> # Read a chunk or all of the buffer into a string, in the specified `encoding`. - # If no encoding is provided `Encoding::BINARY` is used. + # If no encoding is provided Encoding::BINARY is used. # # buffer = IO::Buffer.for('test') # buffer.get_string @@ -375,32 +375,32 @@ class IO # Read from buffer a value of `type` at `offset`. `buffer_type` should be one of # symbols: # - # * `:U8`: unsigned integer, 1 byte - # * `:S8`: signed integer, 1 byte - # * `:u16`: unsigned integer, 2 bytes, little-endian - # * `:U16`: unsigned integer, 2 bytes, big-endian - # * `:s16`: signed integer, 2 bytes, little-endian - # * `:S16`: signed integer, 2 bytes, big-endian - # * `:u32`: unsigned integer, 4 bytes, little-endian - # * `:U32`: unsigned integer, 4 bytes, big-endian - # * `:s32`: signed integer, 4 bytes, little-endian - # * `:S32`: signed integer, 4 bytes, big-endian - # * `:u64`: unsigned integer, 8 bytes, little-endian - # * `:U64`: unsigned integer, 8 bytes, big-endian - # * `:s64`: signed integer, 8 bytes, little-endian - # * `:S64`: signed integer, 8 bytes, big-endian - # * `:u128`: unsigned integer, 16 bytes, little-endian - # * `:U128`: unsigned integer, 16 bytes, big-endian - # * `:s128`: signed integer, 16 bytes, little-endian - # * `:S128`: signed integer, 16 bytes, big-endian - # * `:f32`: float, 4 bytes, little-endian - # * `:F32`: float, 4 bytes, big-endian - # * `:f64`: double, 8 bytes, little-endian - # * `:F64`: double, 8 bytes, big-endian + # * :U8: unsigned integer, 1 byte + # * :S8: signed integer, 1 byte + # * :u16: unsigned integer, 2 bytes, little-endian + # * :U16: unsigned integer, 2 bytes, big-endian + # * :s16: signed integer, 2 bytes, little-endian + # * :S16: signed integer, 2 bytes, big-endian + # * :u32: unsigned integer, 4 bytes, little-endian + # * :U32: unsigned integer, 4 bytes, big-endian + # * :s32: signed integer, 4 bytes, little-endian + # * :S32: signed integer, 4 bytes, big-endian + # * :u64: unsigned integer, 8 bytes, little-endian + # * :U64: unsigned integer, 8 bytes, big-endian + # * :s64: signed integer, 8 bytes, little-endian + # * :S64: signed integer, 8 bytes, big-endian + # * :u128: unsigned integer, 16 bytes, little-endian + # * :U128: unsigned integer, 16 bytes, big-endian + # * :s128: signed integer, 16 bytes, little-endian + # * :S128: signed integer, 16 bytes, big-endian + # * :f32: float, 4 bytes, little-endian + # * :F32: float, 4 bytes, big-endian + # * :f64: double, 8 bytes, little-endian + # * :F64: double, 8 bytes, big-endian # # A buffer type refers specifically to the type of binary buffer that is stored - # in the buffer. For example, a `:u32` buffer type is a 32-bit unsigned integer - # in little-endian format. + # in the buffer. For example, a :u32 buffer type is a 32-bit + # unsigned integer in little-endian format. # # string = [1.5].pack('f') # # => "\x00\x00\xC0?" @@ -557,7 +557,7 @@ class IO # --> # Read at least `length` bytes from the `io` starting at the specified `from` # position, into the buffer starting at `offset`. If an error occurs, return - # `-errno`. + # -errno. # # If `length` is not given or `nil`, it defaults to the size of the buffer minus # the offset, i.e. the entire buffer. @@ -590,7 +590,7 @@ class IO # --> # Write at least `length` bytes from the buffer starting at `offset`, into the # `io` starting at the specified `from` position. If an error occurs, return - # `-errno`. + # -errno. # # If `length` is not given or `nil`, it defaults to the size of the buffer minus # the offset, i.e. the entire buffer. @@ -607,7 +607,7 @@ class IO # IO::Buffer.for('1234567').pwrite(out, 2, 3, 1) # # This leads to `234` (3 bytes, starting from position 1) being written into - # `output.txt`, starting from file position 2. + # output.txt, starting from file position 2. # def pwrite: (untyped, untyped, untyped) -> untyped @@ -616,7 +616,7 @@ class IO # - read(io, [length, [offset]]) -> read length or -errno # --> # Read at least `length` bytes from the `io`, into the buffer starting at - # `offset`. If an error occurs, return `-errno`. + # `offset`. If an error occurs, return -errno. # # If `length` is not given or `nil`, it defaults to the size of the buffer minus # the offset, i.e. the entire buffer. @@ -756,8 +756,8 @@ class IO # minus the specified offset. If the length is negative, it will raise an # ArgumentError. # - # Raises RuntimeError if the `offset+length` is out of the current buffer's - # bounds. + # Raises RuntimeError if the offset+length is out of the current + # buffer's bounds. # # string = 'test' # buffer = IO::Buffer.for(string).dup @@ -841,7 +841,7 @@ class IO # - write(io, [length, [offset]]) -> written length or -errno # --> # Write at least `length` bytes from the buffer starting at `offset`, into the - # `io`. If an error occurs, return `-errno`. + # `io`. If an error occurs, return -errno. # # If `length` is not given or `nil`, it defaults to the size of the buffer minus # the offset, i.e. the entire buffer. @@ -854,7 +854,7 @@ class IO # out = File.open('output.txt', 'wb') # IO::Buffer.for('1234567').write(out, 3) # - # This leads to `123` being written into `output.txt` + # This leads to `123` being written into output.txt # def write: (untyped, untyped) -> untyped diff --git a/core/io/wait.rbs b/core/io/wait.rbs index e045f624c..e5a5e797d 100644 --- a/core/io/wait.rbs +++ b/core/io/wait.rbs @@ -8,17 +8,17 @@ class IO # Waits until the IO becomes ready for the specified events and returns the # subset of events that become ready, or a falsy value when times out. # - # The events can be a bit mask of `IO::READABLE`, `IO::WRITABLE` or - # `IO::PRIORITY`. + # The events can be a bit mask of IO::READABLE, + # IO::WRITABLE or IO::PRIORITY. # # Returns an event mask (truthy value) immediately when buffered data is # available. # - # The second form: if one or more event symbols (`:read`, `:write`, or - # `:read_write`) are passed, the event mask is the bit OR of the bitmask - # corresponding to those symbols. In this form, `timeout` is optional, the - # order of the arguments is arbitrary, and returns `io` if any of the events is - # ready. + # The second form: if one or more event symbols (:read, + # :write, or :read_write) are passed, the event mask + # is the bit OR of the bitmask corresponding to those symbols. In this form, + # `timeout` is optional, the order of the arguments is arbitrary, and returns + # `io` if any of the events is ready. # def wait: (Integer events, ?Time::_Timeout timeout) -> (Integer | false | nil) | (?Time::_Timeout? timeout, *wait_mode mode) -> (self | true | false) diff --git a/core/kernel.rbs b/core/kernel.rbs index 332aa930a..dff2b1b36 100644 --- a/core/kernel.rbs +++ b/core/kernel.rbs @@ -73,15 +73,18 @@ # ### IO # # * ::pp: Prints the given objects in pretty form. -# * #gets: Returns and assigns to `$_` the next line from the current input. +# * #gets: Returns and assigns to $_ the next line from the +# current input. # * #open: Creates an IO object connected to the given stream, file, or # subprocess. # * #p: Prints the given objects' inspect output to the standard output. # * #print: Prints the given objects to standard output without a newline. # * #printf: Prints the string resulting from applying the given format string # to any additional arguments. -# * #putc: Equivalent to `$stdout.putc(object)` for the given object. -# * #puts: Equivalent to `$stdout.puts(*objects)` for the given objects. +# * #putc: Equivalent to $stdout.putc(object) for the given +# object. +# * #puts: Equivalent to $stdout.puts(*objects) for the given +# objects. # * #readline: Similar to #gets, but raises an exception at the end of file. # * #readlines: Returns an array of the remaining lines from the current # input. @@ -150,7 +153,7 @@ module Kernel : BasicObject # - caller(range) -> array or nil # --> # Returns the current execution stack---an array containing strings in the form - # `file:line` or `file:line: in `method'`. + # file:line or file:line: in `method'. # # The optional *start* parameter determines the number of initial stack entries # to omit from the top of the stack. @@ -217,10 +220,10 @@ module Kernel : BasicObject # # catch(1) { 123 } # => 123 # - # If `throw(tag2, val)` is called, Ruby searches up its stack for a `catch` - # block whose `tag` has the same `object_id` as *tag2*. When found, the block - # stops executing and returns *val* (or `nil` if no second argument was given to - # `throw`). + # If throw(tag2, val) is called, Ruby searches up its stack for a + # `catch` block whose `tag` has the same `object_id` as *tag2*. When found, the + # block stops executing and returns *val* (or `nil` if no second argument was + # given to `throw`). # # catch(1) { throw(1, 456) } # => 456 # catch(1) { throw(1) } # => nil @@ -231,8 +234,8 @@ module Kernel : BasicObject # catch(1) {|x| x + 2 } # => 3 # # When no `tag` is given, `catch` yields a new unique object (as from - # `Object.new`) as the block parameter. This object can then be used as the - # argument to `throw`, and will match the correct `catch` block. + # Object.new) as the block parameter. This object can then be used + # as the argument to `throw`, and will match the correct `catch` block. # # catch do |obj_A| # catch do |obj_B| @@ -296,7 +299,7 @@ module Kernel : BasicObject # - block_given? -> true or false # --> # Returns `true` if `yield` would execute a block in the current context. The - # `iterator?` form is mildly deprecated. + # iterator? form is mildly deprecated. # # def try # if block_given? @@ -422,7 +425,8 @@ module Kernel : BasicObject # Array({foo: 0, bar: 1}) # => [[:foo, 0], [:bar, 1]] # Array(0..4) # => [0, 1, 2, 3, 4] # - # Returns `object` in an array, `[object]`, if `object` cannot be converted: + # Returns `object` in an array, [object], if `object` cannot be + # converted: # # Array(:foo) # => [:foo] # @@ -438,8 +442,8 @@ module Kernel : BasicObject # Returns a new Complex object if the arguments are valid; otherwise raises an # exception if `exception` is `true`; otherwise returns `nil`. # - # With Numeric arguments `real` and `imag`, returns `Complex.rect(real, imag)` - # if the arguments are valid. + # With Numeric arguments `real` and `imag`, returns Complex.rect(real, + # imag) if the arguments are valid. # # With string argument `s`, returns a new Complex object if the argument is # valid; the string may have: @@ -449,7 +453,7 @@ module Kernel : BasicObject # coordinates](rdoc-ref:Complex@Rectangular+Coordinates): # # * Sign-separated real and imaginary numeric substrings (with trailing - # character `'i'`): + # character 'i'): # # Complex('1+2i') # => (1+2i) # Complex('+1+2i') # => (1+2i) @@ -457,13 +461,15 @@ module Kernel : BasicObject # Complex('-1+2i') # => (-1+2i) # Complex('-1-2i') # => (-1-2i) # - # * Real-only numeric string (without trailing character `'i'`): + # * Real-only numeric string (without trailing character + # 'i'): # # Complex('1') # => (1+0i) # Complex('+1') # => (1+0i) # Complex('-1') # => (-1+0i) # - # * Imaginary-only numeric string (with trailing character `'i'`): + # * Imaginary-only numeric string (with trailing character + # 'i'): # # Complex('1i') # => (0+1i) # Complex('+1i') # => (0+1i) @@ -490,10 +496,10 @@ module Kernel : BasicObject # - Float(arg, exception: true) -> float or nil # --> # Returns *arg* converted to a float. Numeric types are converted directly, and - # with exception to String and `nil`, the rest are converted using *arg*`.to_f`. - # Converting a String with invalid characters will result in an ArgumentError. - # Converting `nil` generates a TypeError. Exceptions can be suppressed by - # passing `exception: false`. + # with exception to String and `nil`, the rest are converted using + # *arg*.to_f. Converting a String with invalid characters will + # result in an ArgumentError. Converting `nil` generates a TypeError. Exceptions + # can be suppressed by passing exception: false. # # Float(1) #=> 1.0 # Float("123.456") #=> 123.456 @@ -516,7 +522,8 @@ module Kernel : BasicObject # * A hash, returns `object`. # * An empty array or `nil`, returns an empty hash. # - # * Otherwise, if `object.to_hash` returns a hash, returns that hash. + # * Otherwise, if object.to_hash returns a hash, returns that + # hash. # * Otherwise, returns TypeError. # # Examples: @@ -622,7 +629,7 @@ module Kernel : BasicObject # - Rational(x, y, exception: true) -> rational or nil # - Rational(arg, exception: true) -> rational or nil # --> - # Returns `x/y` or `arg` as a Rational. + # Returns x/y or `arg` as a Rational. # # Rational(2, 3) #=> (2/3) # Rational(5) #=> (5/1) @@ -698,7 +705,7 @@ module Kernel : BasicObject # Returns the canonicalized absolute path of the directory of the file from # which this method is called. It means symlinks in the path is resolved. If # `__FILE__` is `nil`, it returns `nil`. The return value equals to - # `File.dirname(File.realpath(__FILE__))`. + # File.dirname(File.realpath(__FILE__)). # def self?.__dir__: () -> String? @@ -715,8 +722,8 @@ module Kernel : BasicObject # rdoc-file=io.c # - `command` -> string # --> - # Returns the `$stdout` output from running `command` in a subshell; sets global - # variable `$?` to the process status. + # Returns the $stdout output from running `command` in a subshell; + # sets global variable $? to the process status. # # This method has potential security vulnerabilities if called with untrusted # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc). @@ -728,7 +735,7 @@ module Kernel : BasicObject # $ $? # => # # $ $?.exitstatus # => 99 # - # The built-in syntax `%x{...}` uses this method. + # The built-in syntax %x{...} uses this method. # def self?.`: (String arg0) -> String @@ -737,7 +744,8 @@ module Kernel : BasicObject # - abort # - Process.abort(msg = nil) # --> - # Terminates execution immediately, effectively by calling `Kernel.exit(false)`. + # Terminates execution immediately, effectively by calling + # Kernel.exit(false). # # If string argument `msg` is given, it is written to STDERR prior to # termination; otherwise, if an exception was raised, prints its message and @@ -760,7 +768,7 @@ module Kernel : BasicObject # do_at_exit("goodbye ") # exit # - # *produces:* + # produces: # # goodbye cruel world # @@ -987,13 +995,14 @@ module Kernel : BasicObject # end # # => # # - # If keyword argument `cause` is not given, the cause is the value of `$!`. + # If keyword argument `cause` is not given, the cause is the value of + # $!. # # See [Cause](rdoc-ref:exceptions.md@Cause). # # In the alternate calling sequence, where argument `exception` *not* given, - # raises a new exception of the class given by `$!`, or of class RuntimeError if - # `$!` is `nil`: + # raises a new exception of the class given by $!, or of class + # RuntimeError if $! is `nil`: # # begin # raise @@ -1095,13 +1104,14 @@ module Kernel : BasicObject # end # # => # # - # If keyword argument `cause` is not given, the cause is the value of `$!`. + # If keyword argument `cause` is not given, the cause is the value of + # $!. # # See [Cause](rdoc-ref:exceptions.md@Cause). # # In the alternate calling sequence, where argument `exception` *not* given, - # raises a new exception of the class given by `$!`, or of class RuntimeError if - # `$!` is `nil`: + # raises a new exception of the class given by $!, or of class + # RuntimeError if $! is `nil`: # # begin # raise @@ -1146,29 +1156,29 @@ module Kernel : BasicObject # - gets(limit [, getline_args]) -> string or nil # - gets(sep, limit [, getline_args]) -> string or nil # --> - # Returns (and assigns to `$_`) the next line from the list of files in `ARGV` - # (or `$*`), or from standard input if no files are present on the command line. - # Returns `nil` at end of file. The optional argument specifies the record - # separator. The separator is included with the contents of each record. A - # separator of `nil` reads the entire contents, and a zero-length separator - # reads the input one paragraph at a time, where paragraphs are divided by two - # consecutive newlines. If the first argument is an integer, or optional second - # argument is given, the returning string would not be longer than the given - # value in bytes. If multiple filenames are present in `ARGV`, `gets(nil)` will - # read the contents one file at a time. + # Returns (and assigns to $_) the next line from the list of files + # in `ARGV` (or $*), or from standard input if no files are present + # on the command line. Returns `nil` at end of file. The optional argument + # specifies the record separator. The separator is included with the contents of + # each record. A separator of `nil` reads the entire contents, and a zero-length + # separator reads the input one paragraph at a time, where paragraphs are + # divided by two consecutive newlines. If the first argument is an integer, or + # optional second argument is given, the returning string would not be longer + # than the given value in bytes. If multiple filenames are present in `ARGV`, + # gets(nil) will read the contents one file at a time. # # ARGV << "testfile" # print while gets # - # *produces:* + # produces: # # This is line one # This is line two # This is line three # And so on... # - # The style of programming using `$_` as an implicit parameter is gradually - # losing favor in the Ruby community. + # The style of programming using $_ as an implicit parameter is + # gradually losing favor in the Ruby community. # def self?.gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String? @@ -1177,8 +1187,9 @@ module Kernel : BasicObject # - global_variables -> array # --> # Returns an array of the names of global variables. This includes special - # regexp global variables such as `$~` and `$+`, but does not include the - # numbered regexp global variables (`$1`, `$2`, etc.). + # regexp global variables such as $~ and $+, but does + # not include the numbered regexp global variables ($1, + # $2, etc.). # # global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr] # @@ -1197,10 +1208,10 @@ module Kernel : BasicObject # the file will be loaded using the relative path from the current directory. # # Otherwise, the file will be searched for in the library directories listed in - # `$LOAD_PATH` (`$:`). If the file is found in a directory, it will attempt to - # load the file relative to that directory. If the file is not found in any of - # the directories in `$LOAD_PATH`, the file will be loaded using the relative - # path from the current directory. + # $LOAD_PATH ($:). If the file is found in a + # directory, it will attempt to load the file relative to that directory. If + # the file is not found in any of the directories in $LOAD_PATH, + # the file will be loaded using the relative path from the current directory. # # If the file doesn't exist when there is an attempt to load it, a LoadError # will be raised. @@ -1275,18 +1286,19 @@ module Kernel : BasicObject # rdoc-file=io.c # - print(*objects) -> nil # --> - # Equivalent to `$stdout.print(*objects)`, this method is the straightforward - # way to write to `$stdout`. + # Equivalent to $stdout.print(*objects), this method is the + # straightforward way to write to $stdout. # - # Writes the given objects to `$stdout`; returns `nil`. Appends the output - # record separator `$OUTPUT_RECORD_SEPARATOR` `$\`), if it is not `nil`. + # Writes the given objects to $stdout; returns `nil`. Appends the + # output record separator $OUTPUT_RECORD_SEPARATOR + # $\), if it is not `nil`. # # With argument `objects` given, for each object: # # * Converts via its method `to_s` if not a string. # * Writes to `stdout`. # * If not the last object, writes the output field separator - # `$OUTPUT_FIELD_SEPARATOR` (`$,` if it is not `nil`. + # $OUTPUT_FIELD_SEPARATOR ($, if it is not `nil`. # # With default separators: # @@ -1311,8 +1323,8 @@ module Kernel : BasicObject # # 0,0.0,0/1,0+0i,zero,zero # - # With no argument given, writes the content of `$_` (which is usually the most - # recent user input): + # With no argument given, writes the content of $_ (which is + # usually the most recent user input): # # gets # Sets $_ to the most recent user input. # print # Prints $_. @@ -1434,7 +1446,7 @@ module Kernel : BasicObject # --> # prints arguments in pretty form. # - # `#pp` returns argument(s). + # #pp returns argument(s). # def self?.pp: [T] (T arg0) -> T | (untyped, untyped, *untyped) -> Array[untyped] @@ -1444,19 +1456,20 @@ module Kernel : BasicObject # rdoc-file=random.c # - rand(max=0) -> number # --> - # If called without an argument, or if `max.to_i.abs == 0`, rand returns a - # pseudo-random floating point number between 0.0 and 1.0, including 0.0 and - # excluding 1.0. + # If called without an argument, or if max.to_i.abs == 0, rand + # returns a pseudo-random floating point number between 0.0 and 1.0, including + # 0.0 and excluding 1.0. # # rand #=> 0.2725926052826416 # - # When `max.abs` is greater than or equal to 1, `rand` returns a pseudo-random - # integer greater than or equal to 0 and less than `max.to_i.abs`. + # When max.abs is greater than or equal to 1, `rand` returns a + # pseudo-random integer greater than or equal to 0 and less than + # max.to_i.abs. # # rand(100) #=> 12 # # When `max` is a Range, `rand` returns a random number where - # `range.member?(number) == true`. + # range.member?(number) == true. # # Negative or floating point values for `max` are allowed, but may give # surprising results. @@ -1557,7 +1570,7 @@ module Kernel : BasicObject # When RubyGems is required, Kernel#require is replaced with our own which is # capable of loading gems on demand. # - # When you call `require 'x'`, this is what happens: + # When you call require 'x', this is what happens: # * If the file can be loaded from the existing Ruby loadpath, it is. # * Otherwise, installed gems are searched for a file that matches. If it's # found in gem 'y', that gem is activated (added to the loadpath). @@ -1592,8 +1605,9 @@ module Kernel : BasicObject # IO objects. # # Argument `timeout` is a numeric value (such as integer or float) timeout - # interval in seconds. `timeout` can also be `nil` or `Float::INFINITY`. `nil` - # and `Float::INFINITY` means no timeout. + # interval in seconds. `timeout` can also be `nil` or + # Float::INFINITY. `nil` and Float::INFINITY means no + # timeout. # # The method monitors the IO objects given in all three arrays, waiting for some # to be ready; returns a 3-element array whose elements are: @@ -1668,8 +1682,8 @@ module Kernel : BasicObject # # The writability notified by select(2) doesn't show how many bytes are # writable. IO#write method blocks until given whole string is written. So, - # `IO#write(two or more bytes)` can block after writability is notified by - # IO.select. IO#write_nonblock is required to avoid the blocking. + # IO#write(two or more bytes) can block after writability is + # notified by IO.select. IO#write_nonblock is required to avoid the blocking. # # Blocking write (#write) can be emulated using #write_nonblock and IO.select as # follows: IO::WaitReadable should also be rescued for SSL renegotiation in @@ -1781,58 +1795,58 @@ module Kernel : BasicObject # * Each of these tests operates only on the entity at `path0`, # and returns `true` or `false`; # for a non-existent entity, returns `false` (does not raise exception): - # Character|Test - # ---------|------------------------------------------------------------------- - # `'b'` |Whether the entity is a block device. - # `'c'` |Whether the entity is a character device. - # `'d'` |Whether the entity is a directory. - # `'e'` |Whether the entity is an existing entity. - # `'f'` |Whether the entity is an existing regular file. - # `'g'` |Whether the entity's setgid bit is set. - # `'G'` |Whether the entity's group ownership is equal to the caller's. - # `'k'` |Whether the entity's sticky bit is set. - # `'l'` |Whether the entity is a symbolic link. - # `'o'` |Whether the entity is owned by the caller's effective uid. - # `'O'` |Like `'o'`, but uses the real uid (not the effective uid). - # `'p'` |Whether the entity is a FIFO device (named pipe). - # `'r'` |Whether the entity is readable by the caller's effective uid/gid. - # `'R'` |Like `'r'`, but uses the real uid/gid (not the effective uid/gid). - # `'S'` |Whether the entity is a socket. - # `'u'` |Whether the entity's setuid bit is set. - # `'w'` |Whether the entity is writable by the caller's effective uid/gid. - # `'W'` |Like `'w'`, but uses the real uid/gid (not the effective uid/gid). - # `'x'` |Whether the entity is executable by the caller's effective uid/gid. - # `'X'` |Like `'x'`, but uses the real uid/gid (not the effective uid/git). - # `'z'` |Whether the entity exists and is of length zero. + # Character |Test + # ----------------|----------------------------------------------------------------------------- + # 'b'|Whether the entity is a block device. + # 'c'|Whether the entity is a character device. + # 'd'|Whether the entity is a directory. + # 'e'|Whether the entity is an existing entity. + # 'f'|Whether the entity is an existing regular file. + # 'g'|Whether the entity's setgid bit is set. + # 'G'|Whether the entity's group ownership is equal to the caller's. + # 'k'|Whether the entity's sticky bit is set. + # 'l'|Whether the entity is a symbolic link. + # 'o'|Whether the entity is owned by the caller's effective uid. + # 'O'|Like 'o', but uses the real uid (not the effective uid). + # 'p'|Whether the entity is a FIFO device (named pipe). + # 'r'|Whether the entity is readable by the caller's effective uid/gid. + # 'R'|Like 'r', but uses the real uid/gid (not the effective uid/gid). + # 'S'|Whether the entity is a socket. + # 'u'|Whether the entity's setuid bit is set. + # 'w'|Whether the entity is writable by the caller's effective uid/gid. + # 'W'|Like 'w', but uses the real uid/gid (not the effective uid/gid). + # 'x'|Whether the entity is executable by the caller's effective uid/gid. + # 'X'|Like 'x', but uses the real uid/gid (not the effective uid/git). + # 'z'|Whether the entity exists and is of length zero. # * This test operates only on the entity at `path0`, - # and returns an integer size or `nil`: - # Character|Test - # ---------|-------------------------------------------------------------------------------------------- - # `'s'` |Returns positive integer size if the entity exists and has non-zero length, `nil` otherwise. + # and returns an integer size or +nil+: + # Character |Test + # ----------------|-------------------------------------------------------------------------------------------- + # 's'|Returns positive integer size if the entity exists and has non-zero length, +nil+ otherwise. # * Each of these tests operates only on the entity at `path0`, # and returns a Time object; # raises an exception if the entity does not exist: - # Character|Test - # ---------|-------------------------------------- - # `'A'` |Last access time for the entity. - # `'C'` |Last change time for the entity. - # `'M'` |Last modification time for the entity. + # Character |Test + # ----------------|-------------------------------------- + # 'A'|Last access time for the entity. + # 'C'|Last change time for the entity. + # 'M'|Last modification time for the entity. # * Each of these tests operates on the modification time (`mtime`) # of each of the entities at `path0` and `path1`, # and returns a `true` or `false`; # returns `false` if either entity does not exist: - # Character|Test - # ---------|--------------------------------------------------------------- - # `'<'` |Whether the `mtime` at `path0` is less than that at `path1`. - # `'='` |Whether the `mtime` at `path0` is equal to that at `path1`. - # `'>'` |Whether the `mtime` at `path0` is greater than that at `path1`. + # Character |Test + # ----------------|--------------------------------------------------------------- + # '<'|Whether the `mtime` at `path0` is less than that at `path1`. + # '='|Whether the `mtime` at `path0` is equal to that at `path1`. + # '>'|Whether the `mtime` at `path0` is greater than that at `path1`. # * This test operates on the content of each of the entities at `path0` and # `path1`, # and returns a `true` or `false`; # returns `false` if either entity does not exist: - # Character|Test - # ---------|--------------------------------------------- - # `'-'` |Whether the entities exist and are identical. + # Character |Test + # ----------------|--------------------------------------------- + # '-'|Whether the entities exist and are identical. # def self?.test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer) @@ -1851,14 +1865,14 @@ module Kernel : BasicObject # rdoc-file=warning.rb # - warn(*msgs, uplevel: nil, category: nil) -> nil # --> - # If warnings have been disabled (for example with the `-W0` flag), does - # nothing. Otherwise, converts each of the messages to strings, appends a + # If warnings have been disabled (for example with the -W0 flag), + # does nothing. Otherwise, converts each of the messages to strings, appends a # newline character to the string if the string does not end in a newline, and # calls Warning.warn with the string. # # warn("warning 1", "warning 2") # - # *produces:* + # produces: # # warning 1 # warning 2 @@ -1878,12 +1892,13 @@ module Kernel : BasicObject # # bar # - # *produces:* + # produces: # # baz.rb:6: warning: invalid call to foo # # If `category` keyword argument is given, passes the category to - # `Warning.warn`. The category given must be one of the following categories: + # Warning.warn. The category given must be one of the following + # categories: # # :deprecated # : Used for warning for deprecated functionality that may be removed in the @@ -1928,7 +1943,7 @@ module Kernel : BasicObject # word or special built-in, or if it contains one or more meta characters. # * `exe_path` otherwise. # - # **Argument `command_line`** + # Argument `command_line` # # String argument `command_line` is a command line to be passed to a shell; it # must begin with a shell reserved word, begin with a special built-in, or @@ -1951,7 +1966,7 @@ module Kernel : BasicObject # # Raises an exception if the new process could not execute. # - # **Argument `exe_path`** + # Argument `exe_path` # # Argument `exe_path` is one of the following: # @@ -2028,7 +2043,7 @@ module Kernel : BasicObject # word or special built-in, or if it contains one or more meta characters. # * `exe_path` otherwise. # - # **Argument `command_line`** + # Argument `command_line` # # String argument `command_line` is a command line to be passed to a shell; it # must begin with a shell reserved word, begin with a special built-in, or @@ -2057,7 +2072,7 @@ module Kernel : BasicObject # # Raises an exception if the new process could not execute. # - # **Argument `exe_path`** + # Argument `exe_path` # # Argument `exe_path` is one of the following: # @@ -2115,7 +2130,7 @@ module Kernel : BasicObject # Raises an exception (instead of returning `false` or `nil`) if keyword # argument `exception` is set to `true`. # - # Assigns the command's error status to `$?`. + # Assigns the command's error status to $?. # # The new process is created using the [system system # call](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/s @@ -2134,7 +2149,7 @@ module Kernel : BasicObject # word or special built-in, or if it contains one or more meta characters. # * `exe_path` otherwise. # - # **Argument `command_line`** + # Argument `command_line` # # String argument `command_line` is a command line to be passed to a shell; it # must begin with a shell reserved word, begin with a special built-in, or @@ -2146,7 +2161,7 @@ module Kernel : BasicObject # system('date > /nop/date.tmp') # => false # system('date > /nop/date.tmp', exception: true) # Raises RuntimeError. # - # Assigns the command's error status to `$?`: + # Assigns the command's error status to $?: # # system('exit') # => true # Built-in. # $? # => # @@ -2166,7 +2181,7 @@ module Kernel : BasicObject # # Raises an exception if the new process could not execute. # - # **Argument `exe_path`** + # Argument `exe_path` # # Argument `exe_path` is one of the following: # @@ -2183,7 +2198,7 @@ module Kernel : BasicObject # # Mon Aug 28 11:43:10 AM CDT 2023 # - # Assigns the command's error status to `$?`: + # Assigns the command's error status to $?: # # system('/usr/bin/date') # => true # $? # => # @@ -2232,7 +2247,7 @@ module Kernel : BasicObject # $_ = "hello" # $_ = ' there' # - # *produces:* + # produces: # # $_ is now 'hello' # $_ is now ' there' @@ -2299,8 +2314,8 @@ module Kernel : BasicObject # --> # Produces a shallow copy of *obj*---the instance variables of *obj* are copied, # but not the objects they reference. #clone copies the frozen value state of - # *obj*, unless the `:freeze` keyword argument is given with a false or true - # value. See also the discussion under Object#dup. + # *obj*, unless the :freeze keyword argument is given with a false + # or true value. See also the discussion under Object#dup. # # class Klass # attr_accessor :str diff --git a/core/marshal.rbs b/core/marshal.rbs index 56e98ce9e..d79e4fe60 100644 --- a/core/marshal.rbs +++ b/core/marshal.rbs @@ -167,9 +167,9 @@ module Marshal # Never pass untrusted data (including user supplied input) to this method. # Please see the overview for further details. # - # If the `freeze: true` argument is passed, deserialized object would be deeply - # frozen. Note that it may lead to more efficient memory usage due to frozen - # strings deduplication: + # If the freeze: true argument is passed, deserialized object would + # be deeply frozen. Note that it may lead to more efficient memory usage due to + # frozen strings deduplication: # # serialized = Marshal.dump(['value1', 'value2', 'value1', 'value2']) # diff --git a/core/match_data.rbs b/core/match_data.rbs index 585425a60..c64d9b6cf 100644 --- a/core/match_data.rbs +++ b/core/match_data.rbs @@ -34,12 +34,14 @@ # Parts of last MatchData (returned by Regexp.last_match) are also aliased as # global variables: # -# * `$~` is Regexp.last_match; -# * `$&` is Regexp.last_match`[ 0 ]`; -# * `$1`, `$2`, and so on are Regexp.last_match`[ i ]` (captures by number); -# * `$`` is Regexp.last_match`.pre_match`; -# * `$'` is Regexp.last_match`.post_match`; -# * `$+` is Regexp.last_match`[ -1 ]` (the last capture). +# * $~ is Regexp.last_match; +# * $& is Regexp.last_match[ 0 ]; +# * $1, $2, and so on are Regexp.last_match[ i +# ] (captures by number); +# * $` is Regexp.last_match.pre_match; +# * $' is Regexp.last_match.post_match; +# * $+ is Regexp.last_match[ -1 ] (the last +# capture). # # See also Regexp@Global+Variables. # @@ -230,7 +232,7 @@ class MatchData # rdoc-file=re.c # - captures -> array # --> - # Returns the array of captures, which are all matches except `m[0]`: + # Returns the array of captures, which are all matches except m[0]: # # m = /(.)(.)(\d+)(\d)/.match("THX1138.") # # => # @@ -242,7 +244,7 @@ class MatchData def captures: () -> Array[String?] # - # Returns the array of captures, which are all matches except `m[0]`: + # Returns the array of captures, which are all matches except m[0]: # # m = /(.)(.)(\d+)(\d)/.match("THX1138.") # # => # @@ -511,8 +513,8 @@ class MatchData # - post_match -> str # --> # Returns the substring of the target string from the end of the first match in - # `self` (that is, `self[0]`) to the end of the string; equivalent to regexp - # global variable `$'`: + # `self` (that is, self[0]) to the end of the string; equivalent to + # regexp global variable $': # # m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie") # # => # @@ -528,8 +530,8 @@ class MatchData # - pre_match -> string # --> # Returns the substring of the target string from its beginning up to the first - # match in `self` (that is, `self[0]`); equivalent to regexp global variable - # `$``: + # match in `self` (that is, self[0]); equivalent to regexp global + # variable $`: # # m = /(.)(.)(\d+)(\d)/.match("THX1138.") # # => # diff --git a/core/math.rbs b/core/math.rbs index 997d4d6ae..ccb1bf2fd 100644 --- a/core/math.rbs +++ b/core/math.rbs @@ -41,8 +41,8 @@ # because many such values are, in mathematics, of infinite precision, while in # numerical computation the precision is finite. # -# Thus, in mathematics, *cos(π/2)* is exactly zero, but in our computation -# `cos(PI/2)` is a number very close to zero: +# Thus, in mathematics, cos(π/2) is exactly zero, but in our +# computation cos(PI/2) is a number very close to zero: # # cos(PI/2) # => 6.123031769111886e-17 # @@ -114,7 +114,7 @@ # # #### Hypotenuse Function # -# * ::hypot: Returns `sqrt(a**2 + b**2)` for the given `a` and `b`. +# * ::hypot: Returns sqrt(a**2 + b**2) for the given `a` and `b`. # module Math # @@ -137,7 +137,7 @@ module Math # # Math.acos(42) # - # *produces:* + # produces: # # Math::DomainError: Numerical argument is out of domain - "acos" # @@ -155,8 +155,8 @@ module Math # Returns the [arc # cosine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`. # - # * Domain: `[-1, 1]`. - # * Range: `[0, PI]`. + # * Domain: [-1, 1]. + # * Range: [0, PI]. # # Examples: # @@ -173,8 +173,8 @@ module Math # Returns the [inverse hyperbolic # cosine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`. # - # * Domain: `[1, INFINITY]`. - # * Range: `[0, INFINITY]`. + # * Domain: [1, INFINITY]. + # * Range: [0, INFINITY]. # # Examples: # @@ -190,8 +190,8 @@ module Math # Returns the [arc # sine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`. # - # * Domain: `[-1, -1]`. - # * Range: `[-PI/2, PI/2]`. + # * Domain: [-1, -1]. + # * Range: [-PI/2, PI/2]. # # Examples: # @@ -208,8 +208,8 @@ module Math # Returns the [inverse hyperbolic # sine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -227,8 +227,8 @@ module Math # tangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of # `x`. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-PI/2, PI/2] `. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-PI/2, PI/2] . # # Examples: # @@ -251,9 +251,9 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain of `y`: `[-INFINITY, INFINITY]`. - # * Domain of `x`: `[-INFINITY, INFINITY]`. - # * Range: `[-PI, PI]`. + # * Domain of `y`: [-INFINITY, INFINITY]. + # * Domain of `x`: [-INFINITY, INFINITY]. + # * Range: [-PI, PI]. # # Examples: # @@ -271,8 +271,8 @@ module Math # Returns the [inverse hyperbolic # tangent](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`. # - # * Domain: `[-1, 1]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [-1, 1]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -288,8 +288,8 @@ module Math # --> # Returns the [cube root](https://en.wikipedia.org/wiki/Cube_root) of `x`. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -315,8 +315,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `(-INFINITY, INFINITY)`. - # * Range: `[-1.0, 1.0]`. + # * Domain: (-INFINITY, INFINITY). + # * Range: [-1.0, 1.0]. # # Examples: # @@ -337,8 +337,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[1, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [1, INFINITY]. # # Examples: # @@ -355,8 +355,8 @@ module Math # Returns the value of the [Gauss error # function](https://en.wikipedia.org/wiki/Error_function) for `x`. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-1, 1]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-1, 1]. # # Examples: # @@ -376,8 +376,8 @@ module Math # function](https://en.wikipedia.org/wiki/Error_function#Complementary_error_fun # ction) for `x`. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[0, 2]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [0, 2]. # # Examples: # @@ -395,8 +395,8 @@ module Math # --> # Returns `e` raised to the `x` power. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[0, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [0, INFINITY]. # # Examples: # @@ -416,8 +416,8 @@ module Math # --> # Returns "exp(x) - 1", `e` raised to the `x` power, minus 1. # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-1.0, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-1.0, INFINITY]. # # Examples: # @@ -444,8 +444,8 @@ module Math # binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format # #IEEE_754_double-precision_binary_floating-point_format:_binary64). # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range `[-INFINITY, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range [-INFINITY, INFINITY]. # # Examples: # @@ -468,8 +468,8 @@ module Math # Returns the value of the [gamma # function](https://en.wikipedia.org/wiki/Gamma_function) for `x`. # - # * Domain: `(-INFINITY, INFINITY]` excluding negative integers. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: (-INFINITY, INFINITY] excluding negative integers. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -491,12 +491,13 @@ module Math # rdoc-file=math.c # - Math.hypot(a, b) -> float # --> - # Returns `sqrt(a**2 + b**2)`, which is the length of the longest side `c` (the - # hypotenuse) of the right triangle whose other sides have lengths `a` and `b`. + # Returns sqrt(a**2 + b**2), which is the length of the longest + # side `c` (the hypotenuse) of the right triangle whose other sides have lengths + # `a` and `b`. # - # * Domain of `a`: `[-INFINITY, INFINITY]`. - # * Domain of +ab: `[-INFINITY, INFINITY]`. - # * Range: `[0, INFINITY]`. + # * Domain of `a`: [-INFINITY, INFINITY]. + # * Domain of +ab: [-INFINITY, INFINITY]. + # * Range: [0, INFINITY]. # # Examples: # @@ -506,8 +507,8 @@ module Math # hypot(5.0, 12.0) # => 13.0 # hypot(1.0, sqrt(3.0)) # => 1.9999999999999998 # Near 2.0 # - # Note that if either argument is `INFINITY` or `-INFINITY`, the result is - # `Infinity`. + # Note that if either argument is `INFINITY` or -INFINITY, the + # result is `Infinity`. # def self.hypot: (double x, double y) -> Float @@ -515,10 +516,11 @@ module Math # rdoc-file=math.c # - Math.ldexp(fraction, exponent) -> float # --> - # Returns the value of `fraction * 2**exponent`. + # Returns the value of fraction * 2**exponent. # - # * Domain of `fraction`: `[0.0, 1.0)`. - # * Domain of `exponent`: `[0, 1024]` (larger values are equivalent to 1024). + # * Domain of `fraction`: [0.0, 1.0). + # * Domain of `exponent`: [0, 1024] (larger values are equivalent + # to 1024). # # See [IEEE 754 double-precision binary floating-point format: # binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format @@ -549,8 +551,8 @@ module Math # See [log gamma # function](https://en.wikipedia.org/wiki/Gamma_function#Log-gamma_function). # - # * Domain: `(-INFINITY, INFINITY]`. - # * Range of first element: `(-INFINITY, INFINITY]`. + # * Domain: (-INFINITY, INFINITY]. + # * Range of first element: (-INFINITY, INFINITY]. # * Second element is -1 or 1. # # Examples: @@ -584,8 +586,8 @@ module Math # Returns the base `base` [logarithm](https://en.wikipedia.org/wiki/Logarithm) # of `x`. # - # * Domain: `[0, INFINITY]`. - # * Range: `[-INFINITY, INFINITY)]`. + # * Domain: [0, INFINITY]. + # * Range: [-INFINITY, INFINITY)]. # # Examples: # @@ -611,8 +613,8 @@ module Math # Returns the base 10 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of # `x`. # - # * Domain: `[0, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [0, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -630,8 +632,8 @@ module Math # Returns "log(x + 1)", the base E # [logarithm](https://en.wikipedia.org/wiki/Logarithm) of (`x` + 1). # - # * Domain: `[-1, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [-1, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -649,8 +651,8 @@ module Math # Returns the base 2 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of # `x`. # - # * Domain: `[0, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [0, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -669,8 +671,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `(-INFINITY, INFINITY)`. - # * Range: `[-1.0, 1.0]`. + # * Domain: (-INFINITY, INFINITY). + # * Range: [-1.0, 1.0]. # # Examples: # @@ -691,8 +693,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-INFINITY, INFINITY]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-INFINITY, INFINITY]. # # Examples: # @@ -709,8 +711,8 @@ module Math # Returns the principal (non-negative) [square # root](https://en.wikipedia.org/wiki/Square_root) of `x`. # - # * Domain: `[0, INFINITY]`. - # * Range: `[0, INFINITY]`. + # * Domain: [0, INFINITY]. + # * Range: [0, INFINITY]. # # Examples: # @@ -733,8 +735,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `(-INFINITY, INFINITY)`. - # * Range: `(-INFINITY, INFINITY)`. + # * Domain: (-INFINITY, INFINITY). + # * Range: (-INFINITY, INFINITY). # # Examples: # @@ -755,8 +757,8 @@ module Math # [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus # _degrees). # - # * Domain: `[-INFINITY, INFINITY]`. - # * Range: `[-1, 1]`. + # * Domain: [-INFINITY, INFINITY]. + # * Range: [-1, 1]. # # Examples: # diff --git a/core/method.rbs b/core/method.rbs index e2bd40899..a96346ba2 100644 --- a/core/method.rbs +++ b/core/method.rbs @@ -74,12 +74,12 @@ class Method # Net::HTTP.method(:get).inspect # #=> "#/lib/ruby/2.7.0/net/http.rb:457>" # - # `...` in argument definition means argument is optional (has some default - # value). + # ... in argument definition means argument is optional (has some + # default value). # # For methods defined in C (language core and extensions), location and argument # names can't be extracted, and only generic information is provided in form of - # `*` (any number of arguments) or `_` (some positional argument). + # * (any number of arguments) or `_` (some positional argument). # # "cat".method(:count).inspect #=> "#" # "cat".method(:+).inspect #=> "#"" @@ -102,12 +102,12 @@ class Method # Net::HTTP.method(:get).inspect # #=> "#/lib/ruby/2.7.0/net/http.rb:457>" # - # `...` in argument definition means argument is optional (has some default - # value). + # ... in argument definition means argument is optional (has some + # default value). # # For methods defined in C (language core and extensions), location and argument # names can't be extracted, and only generic information is provided in form of - # `*` (any number of arguments) or `_` (some positional argument). + # * (any number of arguments) or `_` (some positional argument). # # "cat".method(:count).inspect #=> "#" # "cat".method(:+).inspect #=> "#"" diff --git a/core/module.rbs b/core/module.rbs index b585bc43c..f98de70c4 100644 --- a/core/module.rbs +++ b/core/module.rbs @@ -6,7 +6,7 @@ # methods may not. (See Module#module_function.) # # In the descriptions that follow, the parameter *sym* refers to a symbol, which -# is either a quoted string or a Symbol (such as `:name`). +# is either a quoted string or a Symbol (such as :name). # # module Mod # include Math @@ -79,7 +79,7 @@ class Module < Object # using B # p Module.used_modules # - # *produces:* + # produces: # # [B, A] # @@ -106,7 +106,7 @@ class Module < Object # using B # p Module.used_refinements # - # *produces:* + # produces: # # [#, #] # @@ -144,7 +144,8 @@ class Module < Object # # Returns: # - # * `-1`, if `self` includes `other`, if or `self` is a subclass of `other`. + # * -1, if `self` includes `other`, if or `self` is a subclass of + # `other`. # * `0`, if `self` and `other` are the same. # * `1`, if `other` includes `self`, or if `other` is a subclass of `self`. # * `nil`, if none of the above is true. @@ -175,8 +176,8 @@ class Module < Object # 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, a.equal?(b) if and + # only if `a` is the same object as `b`): # # obj = "a" # other = obj.dup @@ -249,7 +250,7 @@ class Module < Object # include Mod # exit(99) # - # *produces:* + # produces: # # Exiting with code 99 # @@ -292,10 +293,10 @@ class Module < Object # - attr_accessor(string, ...) -> array # --> # Defines a named attribute for this module, where the name is - # *symbol.*`id2name`, creating an instance variable (`@name`) and a - # corresponding access method to read it. Also creates a method called `name=` - # to set the attribute. String arguments are converted to symbols. Returns an - # array of defined method names as symbols. + # symbol.`id2name`, creating an instance variable (@name) + # and a corresponding access method to read it. Also creates a method called + # name= to set the attribute. String arguments are converted to + # symbols. Returns an array of defined method names as symbols. # # module Mod # attr_accessor(:one, :two) #=> [:one, :one=, :two, :two=] @@ -312,8 +313,8 @@ class Module < Object # - attr(string, ...) -> array # --> # Creates instance variables and corresponding methods that return the value of - # each instance variable. Equivalent to calling ```attr`*:name*'' on each name - # in turn. String arguments are converted to symbols. Returns an array of + # each instance variable. Equivalent to calling ```attr`:name'' on each + # name in turn. String arguments are converted to symbols. Returns an array of # defined method names as symbols. # def attr_reader: (*interned arg0) -> Array[Symbol] @@ -324,8 +325,8 @@ class Module < Object # - attr_writer(string, ...) -> array # --> # Creates an accessor method to allow assignment to the attribute - # *symbol*`.id2name`. String arguments are converted to symbols. Returns an - # array of defined method names as symbols. + # *symbol*.id2name. String arguments are converted to symbols. + # Returns an array of defined method names as symbols. # def attr_writer: (*interned arg0) -> Array[Symbol] @@ -390,7 +391,7 @@ class Module < Object # puts Thing.new.hello() # Thing.module_eval("invalid code", "dummy", 123) # - # *produces:* + # produces: # # Hello there! # dummy:123:in `module_eval': undefined local variable @@ -412,7 +413,7 @@ class Module < Object # } # puts Thing.new.hello() # - # *produces:* + # produces: # # Hello there! # @@ -440,8 +441,8 @@ class Module < Object # - mod.class_variable_get(string) -> obj # --> # Returns the value of the given class variable (or throws a NameError - # exception). The `@@` part of the variable name should be included for regular - # class variables. String arguments are converted to symbols. + # exception). The @@ part of the variable name should be included + # for regular class variables. String arguments are converted to symbols. # # class Fred # @@foo = 99 @@ -503,7 +504,7 @@ class Module < Object # FOO = 1 # end # - # *produces:* + # produces: # # Added :FOO # @@ -527,7 +528,7 @@ class Module < Object # end # end # - # *produces:* + # produces: # # :const_added # :inherited @@ -635,10 +636,11 @@ class Module < Object # # In the next example, when a reference is made to an undefined constant, # `const_missing` attempts to load a file whose path is the lowercase version of - # the constant name (thus class `Fred` is assumed to be in file `fred.rb`). If - # defined as a side-effect of loading the file, the method returns the value - # stored in the constant. This implements an autoload feature similar to - # Kernel#autoload and Module#autoload, though it differs in important ways. + # the constant name (thus class `Fred` is assumed to be in file + # fred.rb). If defined as a side-effect of loading the file, the + # method returns the value stored in the constant. This implements an autoload + # feature similar to Kernel#autoload and Module#autoload, though it differs in + # important ways. # # def Object.const_missing(name) # @looked_for ||= {} @@ -680,7 +682,8 @@ class Module < Object # If the constant is found, but its source location can not be extracted # (constant is defined in C code), empty array is returned. # - # *inherit* specifies whether to lookup in `mod.ancestors` (`true` by default). + # *inherit* specifies whether to lookup in mod.ancestors (`true` by + # default). # # # test.rb: # class A # line 1 @@ -769,7 +772,7 @@ class Module < Object # a.create_method(:betty) { p self } # a.betty # - # *produces:* + # produces: # # In Fred # Charge it! @@ -821,7 +824,7 @@ class Module < Object # (s = Array.new).extend Picky # Call Object.extend # (s = "quick brown fox").extend Picky # - # *produces:* + # produces: # # Picky added to Array # Can't add Picky to a String @@ -889,8 +892,8 @@ class Module < Object # - included(othermod) # --> # Callback invoked whenever the receiver is included in another module or class. - # This should be used in preference to `Module.append_features` if your code - # wants to perform some action when a module is included in another. + # This should be used in preference to Module.append_features if + # your code wants to perform some action when a module is included in another. # # module A # def A.included(mod) @@ -980,7 +983,7 @@ class Module < Object # interpreter = Interpreter.new # interpreter.interpret('dave') # - # *produces:* + # produces: # # Hello there, Dave! # @@ -1037,7 +1040,7 @@ class Module < Object # def some_instance_method() end # end # - # *produces:* + # produces: # # Adding :some_instance_method # @@ -1098,7 +1101,7 @@ class Module < Object # remove_method :some_instance_method # end # - # *produces:* + # produces: # # Removing :some_instance_method # @@ -1123,7 +1126,7 @@ class Module < Object # undef_method :some_instance_method # end # - # *produces:* + # produces: # # Undefining :some_instance_method # @@ -1149,7 +1152,7 @@ class Module < Object # puts Thing.new.hello() # Thing.module_eval("invalid code", "dummy", 123) # - # *produces:* + # produces: # # Hello there! # dummy:123:in `module_eval': undefined local variable @@ -1175,7 +1178,7 @@ class Module < Object # } # puts Thing.new.hello() # - # *produces:* + # produces: # # Hello there! # @@ -1295,7 +1298,7 @@ class Module < Object # end # Mod.private_instance_methods #=> [:a, :c] # - # Note that to show a private method on RDoc, use `:doc:`. + # Note that to show a private method on RDoc, use :doc:. # private def private: () -> nil | (Symbol method_name) -> Symbol @@ -1403,9 +1406,9 @@ class Module < Object # Marking a method as protected allows **different objects of the same class** # to call it. # - # One use case is for comparison methods, such as `==`, if we want to expose a - # method for comparison between objects of the same class without making the - # method public to objects of other classes. + # One use case is for comparison methods, such as ==, if we want to + # expose a method for comparison between objects of the same class without + # making the method public to objects of other classes. # # ## Performance considerations # @@ -1436,7 +1439,7 @@ class Module < Object # account1 > account2 # => true (works) # account1.balance # => NoMethodError (fails because balance is not public) # - # To show a private method on RDoc, use `:doc:` instead of this. + # To show a private method on RDoc, use :doc: instead of this. # private def protected: () -> nil | (Symbol method_name) -> Symbol @@ -1600,7 +1603,7 @@ class Module < Object # # p A.refinements # - # *produces:* + # produces: # # [#, #] # @@ -1619,7 +1622,7 @@ class Module < Object # p(defined? @@var) # end # - # *produces:* + # produces: # # 99 # nil @@ -1652,13 +1655,13 @@ class Module < Object # --> # For the given method names, marks the method as passing keywords through a # normal argument splat. This should only be called on methods that accept an - # argument splat (`*args`) but not explicit keywords or a keyword splat. It - # marks the method such that if the method is called with keyword arguments, the - # final hash argument is marked with a special flag such that if it is the final - # element of a normal argument splat to another method call, and that method - # call does not include explicit keywords or a keyword splat, the final element - # is interpreted as keywords. In other words, keywords will be passed through - # the method to other methods. + # argument splat (*args) but not explicit keywords or a keyword + # splat. It marks the method such that if the method is called with keyword + # arguments, the final hash argument is marked with a special flag such that if + # it is the final element of a normal argument splat to another method call, and + # that method call does not include explicit keywords or a keyword splat, the + # final element is interpreted as keywords. In other words, keywords will be + # passed through the method to other methods. # # This should only be used for methods that delegate keywords to another method, # and only for backwards compatibility with Ruby versions before 3.0. See @@ -1790,7 +1793,7 @@ class Module < Object # end # c.hello # - # *produces:* + # produces: # # In child # In parent @@ -1830,9 +1833,9 @@ class Module < Object # - attr(name, false) -> array # --> # The first form is equivalent to #attr_reader. The second form is equivalent to - # `attr_accessor(name)` but deprecated. The last form is equivalent to - # `attr_reader(name)` but deprecated. Returns an array of defined method names - # as symbols. + # attr_accessor(name) but deprecated. The last form is equivalent + # to attr_reader(name) but deprecated. Returns an array of defined + # method names as symbols. # def attr: %a{deprecated} (interned, bool) -> Array[Symbol] | (*interned arg0) -> Array[Symbol] diff --git a/core/nil_class.rbs b/core/nil_class.rbs index d422b30df..bafe77e51 100644 --- a/core/nil_class.rbs +++ b/core/nil_class.rbs @@ -19,7 +19,7 @@ # * #to_s # # While `nil` doesn't have an explicitly defined #to_hash method, it can be used -# in `**` unpacking, not adding any keyword arguments. +# in ** unpacking, not adding any keyword arguments. # # Another method provides inspection: # @@ -97,7 +97,7 @@ class NilClass # rdoc-file=object.c # - inspect -> 'nil' # --> - # Returns string `'nil'`: + # Returns string 'nil': # # nil.inspect # => "nil" # @@ -107,7 +107,8 @@ class NilClass # rdoc-file=object.c # - nil.nil? -> true # --> - # Returns `true`. For all other objects, method `nil?` returns `false`. + # Returns `true`. For all other objects, method nil? returns + # `false`. # def nil?: () -> true diff --git a/core/numeric.rbs b/core/numeric.rbs index 81aeb7aa4..fe6f800cd 100644 --- a/core/numeric.rbs +++ b/core/numeric.rbs @@ -23,10 +23,10 @@ # two-member Array containing an object that has been coerced into an instance # of the new class and `self` (see #coerce). # -# Inheriting classes should also implement arithmetic operator methods (`+`, -# `-`, `*` and `/`) and the `<=>` operator (see Comparable). These methods may -# rely on `coerce` to ensure interoperability with instances of other numeric -# classes. +# Inheriting classes should also implement arithmetic operator methods +# (+, -, * and /) and the +# <=> operator (see Comparable). These methods may rely on `coerce` +# to ensure interoperability with instances of other numeric classes. # # class Tally < Numeric # def initialize(string) @@ -88,7 +88,7 @@ # # * #finite?: Returns true unless `self` is infinite or not a number. # * #infinite?: Returns -1, `nil` or +1, depending on whether `self` is -# `-Infinity, finite, or +Infinity`. +# -Infinity, finite, or +Infinity. # * #integer?: Returns whether `self` is an integer. # * #negative?: Returns whether `self` is negative. # * #nonzero?: Returns whether `self` is not zero. @@ -119,27 +119,29 @@ # Math::PI otherwise. # * #ceil: Returns the smallest number greater than or equal to `self`, to a # given precision. -# * #coerce: Returns array `[coerced_self, coerced_other]` for the given other -# value. +# * #coerce: Returns array [coerced_self, coerced_other] for the +# given other value. # * #conj (aliased as #conjugate): Returns the complex conjugate of `self`. # * #denominator: Returns the denominator (always positive) of the Rational # representation of `self`. # * #div: Returns the value of `self` divided by the given value and converted # to an integer. -# * #divmod: Returns array `[quotient, modulus]` resulting from dividing -# `self` the given divisor. +# * #divmod: Returns array [quotient, modulus] resulting from +# dividing `self` the given divisor. # * #fdiv: Returns the Float result of dividing `self` by the given divisor. # * #floor: Returns the largest number less than or equal to `self`, to a # given precision. -# * #i: Returns the Complex object `Complex(0, self)`. the given value. +# * #i: Returns the Complex object Complex(0, self). the given +# value. # * #imaginary (aliased as #imag): Returns the imaginary part of the `self`. # * #numerator: Returns the numerator of the Rational representation of # `self`; has the same sign as `self`. -# * #polar: Returns the array `[self.abs, self.arg]`. +# * #polar: Returns the array [self.abs, self.arg]. # * #quo: Returns the value of `self` divided by the given value. # * #real: Returns the real part of `self`. -# * #rect (aliased as #rectangular): Returns the array `[self, 0]`. -# * #remainder: Returns `self-arg*(self/arg).truncate` for the given `arg`. +# * #rect (aliased as #rectangular): Returns the array [self, 0]. +# * #remainder: Returns self-arg*(self/arg).truncate for the +# given `arg`. # * #round: Returns the value of `self` rounded to the nearest value for the # given a precision. # * #to_c: Returns the Complex representation of `self`. @@ -275,7 +277,7 @@ class Numeric # as specified by the given `ndigits`, which must be an [integer-convertible # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects). # - # Equivalent to `self.to_f.ceil(ndigits)`. + # Equivalent to self.to_f.ceil(ndigits). # # Related: #floor, Float#ceil. # @@ -343,9 +345,9 @@ class Numeric # rdoc-file=numeric.c # - div(other) -> integer # --> - # Returns the quotient `self/other` as an integer (via `floor`), using method - # `/` as defined in the subclass of Numeric. (Numeric itself does not define - # `/`.) + # Returns the quotient self/other as an integer (via `floor`), + # using method / as defined in the subclass of Numeric. (Numeric + # itself does not define /.) # # Of the Core and Standard Library classes, Only Float and Rational use this # implementation. @@ -356,7 +358,7 @@ class Numeric # rdoc-file=numeric.c # - divmod(other) -> array # --> - # Returns a 2-element array `[q, r]`, where + # Returns a 2-element array [q, r], where # # q = (self/other).floor # Quotient # r = self % other # Remainder @@ -397,8 +399,8 @@ class Numeric # 1.eql?(Rational(1, 1)) # => false # 1.eql?(Complex(1, 0)) # => false # - # Method `eql?` is different from `==` in that `eql?` requires matching types, - # while `==` does not. + # Method eql? is different from == in that + # eql? requires matching types, while == does not. # def eql?: (untyped) -> bool @@ -406,8 +408,9 @@ class Numeric # rdoc-file=numeric.c # - fdiv(other) -> float # --> - # Returns the quotient `self/other` as a float, using method `/` as defined in - # the subclass of Numeric. (Numeric itself does not define `/`.) + # Returns the quotient self/other as a float, using method + # / as defined in the subclass of Numeric. (Numeric itself does not + # define /.) # # Of the Core and Standard Library classes, only BigDecimal uses this # implementation. @@ -430,7 +433,7 @@ class Numeric # specified by the given `ndigits`, which must be an [integer-convertible # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects). # - # Equivalent to `self.to_f.floor(ndigits)`. + # Equivalent to self.to_f.floor(ndigits). # # Related: #ceil, Float#floor. # @@ -441,7 +444,7 @@ class Numeric # rdoc-file=numeric.c # - i -> complex # --> - # Returns `Complex(0, self)`: + # Returns Complex(0, self): # # 2.i # => (0+2i) # -2.i # => (0-2i) @@ -470,8 +473,8 @@ class Numeric # rdoc-file=numeric.rb # - infinite? -> -1, 1, or nil # --> - # Returns `nil`, -1, or 1 depending on whether `self` is finite, `-Infinity`, or - # `+Infinity`. + # Returns `nil`, -1, or 1 depending on whether `self` is finite, + # -Infinity, or +Infinity. # def infinite?: () -> Integer? @@ -539,7 +542,7 @@ class Numeric # - nonzero? -> self or nil # --> # Returns `self` if `self` is not a zero value, `nil` otherwise; uses method - # `zero?` for the evaluation. + # zero? for the evaluation. # # The returned `self` allows the method to be chained: # @@ -571,7 +574,7 @@ class Numeric # rdoc-file=complex.c # - polar -> array # --> - # Returns array `[self.abs, self.arg]`. + # Returns array [self.abs, self.arg]. # def polar: () -> [ Numeric, Numeric ] @@ -609,7 +612,7 @@ class Numeric def real?: () -> true # - # Returns array `[self, 0]`. + # Returns array [self, 0]. # def rect: () -> [ Numeric, Numeric ] @@ -617,7 +620,7 @@ class Numeric # rdoc-file=complex.c # - rect -> array # --> - # Returns array `[self, 0]`. + # Returns array [self, 0]. # alias rectangular rect @@ -753,8 +756,8 @@ class Numeric # If all the arguments are integers, the loop operates using an integer counter. # # If any of the arguments are floating point numbers, all are converted to - # floats, and the loop is executed *floor(n + n*Float::EPSILON) + 1* times, - # where *n = (limit - self)/step*. + # floats, and the loop is executed floor(n + n*Float::EPSILON) + 1 + # times, where n = (limit - self)/step. # def step: (?Numeric limit, ?Numeric step) { (Numeric) -> void } -> self | (?Numeric limit, ?Numeric step) -> Enumerator::ArithmeticSequence diff --git a/core/object.rbs b/core/object.rbs index 99ad20486..d63088257 100644 --- a/core/object.rbs +++ b/core/object.rbs @@ -12,7 +12,8 @@ # will find the top-level File class. # # In the descriptions of Object's methods, the parameter *symbol* refers to a -# symbol, which is either a quoted string or a Symbol (such as `:name`). +# symbol, which is either a quoted string or a Symbol (such as +# :name). # # ## What's Here # @@ -32,7 +33,7 @@ # * #!~: Returns `true` if `self` does not match the given object, otherwise # `false`. # * #<=>: Returns 0 if `self` and the given object `object` are the same -# object, or if `self == object`; otherwise returns `nil`. +# object, or if self == object; otherwise returns `nil`. # * #===: Implements case equality, effectively the same as calling #==. # * #eql?: Implements hash equality, effectively the same as calling #==. # * #kind_of? (aliased as #is_a?): Returns whether given argument is an @@ -43,7 +44,8 @@ # * #method: Returns the `Method` object for the given method in `self`. # * #methods: Returns an array of symbol names of public and protected methods # in `self`. -# * #nil?: Returns `false`. (Only `nil` responds `true` to method `nil?`.) +# * #nil?: Returns `false`. (Only `nil` responds `true` to method +# nil?.) # * #object_id: Returns an integer corresponding to `self` that is unique for # the current process # * #private_methods: Returns an array of the symbol names of the private @@ -85,7 +87,7 @@ # frozen state. # * #define_singleton_method: Defines a singleton method in `self` for the # given symbol method-name and block or proc. -# * #display: Prints `self` to the given IO stream or `$stdout`. +# * #display: Prints `self` to the given IO stream or $stdout. # * #dup: Returns a shallow unfrozen copy of `self`. # * #enum_for (aliased as #to_enum): Returns an Enumerator for `self` using # the using the given method, arguments, and block. diff --git a/core/object_space.rbs b/core/object_space.rbs index ab1622c5b..030a1dcfa 100644 --- a/core/object_space.rbs +++ b/core/object_space.rbs @@ -5,8 +5,8 @@ # # ObjectSpace also provides support for object finalizers, procs that will be # called after a specific object was destroyed by garbage collection. See the -# documentation for `ObjectSpace.define_finalizer` for important information on -# how to use this method correctly. +# documentation for ObjectSpace.define_finalizer for important +# information on how to use this method correctly. # # a = "A" # b = "B" @@ -17,7 +17,7 @@ # a = nil # b = nil # -# *produces:* +# produces: # # Finalizer two on 537763470 # Finalizer one on 537763480 @@ -50,9 +50,9 @@ module ObjectSpace # The contents of the returned hash are implementation specific. It may be # changed in future. # - # The keys starting with `:T_` means live objects. For example, `:T_ARRAY` is - # the number of arrays. `:FREE` means object slots which is not used now. - # `:TOTAL` means sum of above. + # The keys starting with :T_ means live objects. For example, + # :T_ARRAY is the number of arrays. :FREE means object + # slots which is not used now. :TOTAL means sum of above. # # If the optional argument `result_hash` is given, it is overwritten and # returned. This is intended to avoid probe effect. @@ -74,7 +74,7 @@ module ObjectSpace # object ID of the *obj* will be passed as an argument to *aProc*. If *aProc* is # a lambda or method, make sure it can be called with a single argument. # - # The return value is an array `[0, aProc]`. + # The return value is an array [0, aProc]. # # The two recommended patterns are to either create the finaliser proc in a # non-instance method where it can safely capture the needed state, or to use a @@ -147,7 +147,7 @@ module ObjectSpace # count = ObjectSpace.each_object(Job) {|x| p x } # puts "Total count: #{count}" # - # *produces:* + # produces: # # # # # @@ -155,8 +155,9 @@ module ObjectSpace # # Due to a current Ractor implementation issue, this method does not yield # Ractor-unshareable objects when the process is in multi-Ractor mode. - # Multi-ractor mode is enabled when `Ractor.new` has been called for the first - # time. See https://bugs.ruby-lang.org/issues/19387 for more information. + # Multi-ractor mode is enabled when Ractor.new has been called for + # the first time. See https://bugs.ruby-lang.org/issues/19387 for more + # information. # # a = 12345678987654321 # shareable # b = [].freeze # shareable diff --git a/core/pathname.rbs b/core/pathname.rbs index a04ee70b2..cdcfc82ba 100644 --- a/core/pathname.rbs +++ b/core/pathname.rbs @@ -193,7 +193,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - getwd() # --> - # See `Dir.getwd`. Returns the current working directory as a Pathname. + # See Dir.getwd. Returns the current working directory as a + # Pathname. # def self.getwd: () -> Pathname @@ -201,7 +202,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - glob(*args, **kwargs) { |pathname| ... } # --> - # See `Dir.glob`. Returns or yields Pathname objects. + # See Dir.glob. Returns or yields Pathname objects. # def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname] | (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil @@ -253,9 +254,9 @@ class Pathname # Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN') # #=> 1 # - # It will return `-1`, `0` or `1` depending on the value of the left argument - # relative to the right argument. Or it will return `nil` if the arguments are - # not comparable. + # It will return -1, `0` or `1` depending on the value of the left + # argument relative to the right argument. Or it will return `nil` if the + # arguments are not comparable. # def <=>: (Pathname other) -> Integer | (untyped other) -> nil @@ -265,8 +266,8 @@ class Pathname # - ==(other) # --> # Compare this pathname with `other`. The comparison is string-based. Be aware - # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same - # file. + # that two different paths (foo.txt and ./foo.txt) can + # refer to the same file. # def ==: (untyped) -> bool @@ -331,7 +332,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - atime() # --> - # See `File.atime`. Returns last access time. + # See File.atime. Returns last access time. # def atime: () -> Time @@ -339,7 +340,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - basename(...) # --> - # See `File.basename`. Returns the last component of the path. + # See File.basename. Returns the last component of the path. # def basename: (?String | _ToStr suffix) -> Pathname @@ -347,8 +348,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - binread(...) # --> - # See `File.binread`. Returns all the bytes from the file, or the first `N` if - # specified. + # See File.binread. Returns all the bytes from the file, or the + # first `N` if specified. # def binread: (?Integer length, ?Integer offset) -> String @@ -377,7 +378,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - blockdev?() # --> - # See `FileTest.blockdev?`. + # See FileTest.blockdev?. # def blockdev?: () -> bool @@ -385,7 +386,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - chardev?() # --> - # See `FileTest.chardev?`. + # See FileTest.chardev?. # def chardev?: () -> bool @@ -409,8 +410,8 @@ class Pathname # pn.children(false) # # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ] # - # Note that the results never contain the entries `.` and `..` in the directory - # because they are not children. + # Note that the results never contain the entries . and + # .. in the directory because they are not children. # def children: (?boolish with_directory) -> Array[Pathname] @@ -418,7 +419,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - chmod(mode) # --> - # See `File.chmod`. Changes permissions. + # See File.chmod. Changes permissions. # def chmod: (Integer mode_int) -> Integer @@ -426,7 +427,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - chown(owner, group) # --> - # See `File.chown`. Change owner and group of file. + # See File.chown. Change owner and group of file. # def chown: (Integer owner, Integer group) -> Integer @@ -438,9 +439,9 @@ class Pathname # removed. The filesystem is not accessed. # # If `consider_symlink` is `true`, then a more conservative algorithm is used to - # avoid breaking symbolic linkages. This may retain more `..` entries than - # absolutely necessary, but without accessing the filesystem, this can't be - # avoided. + # avoid breaking symbolic linkages. This may retain more .. + # entries than absolutely necessary, but without accessing the filesystem, this + # can't be avoided. # # See Pathname#realpath. # @@ -450,7 +451,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - ctime() # --> - # See `File.ctime`. Returns last (directory entry, not file) change time. + # See File.ctime. Returns last (directory entry, not file) change + # time. # def ctime: () -> Time @@ -497,7 +499,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - directory?() # --> - # See `FileTest.directory?`. + # See FileTest.directory?. # def directory?: () -> bool @@ -505,7 +507,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - dirname() # --> - # See `File.dirname`. Returns all but the last component of the path. + # See File.dirname. Returns all but the last component of the + # path. # def dirname: () -> Pathname @@ -544,8 +547,8 @@ class Pathname # # # # # # # - # Note that the results never contain the entries `.` and `..` in the directory - # because they are not children. + # Note that the results never contain the entries . and + # .. in the directory because they are not children. # # See Pathname#children # @@ -626,7 +629,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - executable?() # --> - # See `FileTest.executable?`. + # See FileTest.executable?. # def executable?: () -> bool @@ -634,7 +637,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - executable_real?() # --> - # See `FileTest.executable_real?`. + # See FileTest.executable_real?. # def executable_real?: () -> bool @@ -642,7 +645,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - exist?() # --> - # See `FileTest.exist?`. + # See FileTest.exist?. # def exist?: () -> bool @@ -650,7 +653,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - expand_path(...) # --> - # See `File.expand_path`. + # See File.expand_path. # def expand_path: (?String dir) -> Pathname @@ -658,7 +661,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - extname() # --> - # See `File.extname`. Returns the file's extension. + # See File.extname. Returns the file's extension. # def extname: () -> String @@ -666,7 +669,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - file?() # --> - # See `FileTest.file?`. + # See FileTest.file?. # def file?: () -> bool @@ -674,7 +677,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - fnmatch(pattern, ...) # --> - # See `File.fnmatch`. Return `true` if the receiver matches the given pattern. + # See File.fnmatch. Return `true` if the receiver matches the + # given pattern. # def fnmatch: (String pattern, ?Integer flags) -> bool @@ -682,7 +686,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - fnmatch?(pattern, ...) # --> - # See `File.fnmatch?` (same as #fnmatch). + # See File.fnmatch? (same as #fnmatch). # alias fnmatch? fnmatch @@ -698,7 +702,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - ftype() # --> - # See `File.ftype`. Returns "type" of file ("file", "directory", etc). + # See File.ftype. Returns "type" of file ("file", "directory", + # etc). # def ftype: () -> String @@ -720,7 +725,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - grpowned?() # --> - # See `FileTest.grpowned?`. + # See FileTest.grpowned?. # def grpowned?: () -> bool @@ -749,7 +754,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - lchmod(mode) # --> - # See `File.lchmod`. + # See File.lchmod. # def lchmod: (Integer mode) -> Integer @@ -757,7 +762,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - lchown(owner, group) # --> - # See `File.lchown`. + # See File.lchown. # def lchown: (Integer owner, Integer group) -> Integer @@ -765,7 +770,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - lstat() # --> - # See `File.lstat`. + # See File.lstat. # def lstat: () -> ::File::Stat @@ -785,7 +790,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - make_link(old) # --> - # See `File.link`. Creates a hard link. + # See File.link. Creates a hard link. # def make_link: (String | Pathname | _ToStr old) -> Integer @@ -793,7 +798,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - make_symlink(old) # --> - # See `File.symlink`. Creates a symbolic link. + # See File.symlink. Creates a symbolic link. # def make_symlink: (String | Pathname | _ToStr old) -> Integer @@ -801,7 +806,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - mkdir(...) # --> - # See `Dir.mkdir`. Create the referenced directory. + # See Dir.mkdir. Create the referenced directory. # def mkdir: (?Integer perm) -> Integer @@ -828,7 +833,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - mtime() # --> - # See `File.mtime`. Returns last modification time. + # See File.mtime. Returns last modification time. # def mtime: () -> Time @@ -836,7 +841,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - open(...) { |file| ... } # --> - # See `File.open`. Opens the file for reading or writing. + # See File.open. Opens the file for reading or writing. # def open: ( ?string | int mode, @@ -888,7 +893,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - opendir() { |dir| ... } # --> - # See `Dir.open`. + # See Dir.open. # def opendir: () -> Dir | [U] () { (Dir) -> U } -> U @@ -897,7 +902,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - owned?() # --> - # See `FileTest.owned?`. + # See FileTest.owned?. # def owned?: () -> bool @@ -907,7 +912,7 @@ class Pathname # --> # Returns the parent directory. # - # This is same as `self + '..'`. + # This is same as self + '..'. # def parent: () -> Pathname @@ -915,7 +920,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - pipe?() # --> - # See `FileTest.pipe?`. + # See FileTest.pipe?. # def pipe?: () -> bool @@ -923,8 +928,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - read(...) # --> - # See `File.read`. Returns all data from the file, or the first `N` bytes if - # specified. + # See File.read. Returns all data from the file, or the first `N` + # bytes if specified. # def read: (?Integer length, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> String @@ -932,7 +937,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - readable?() # --> - # See `FileTest.readable?`. + # See FileTest.readable?. # def readable?: () -> bool @@ -940,7 +945,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - readable_real?() # --> - # See `FileTest.readable_real?`. + # See FileTest.readable_real?. # def readable_real?: () -> bool @@ -948,7 +953,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - readlines(...) # --> - # See `File.readlines`. Returns all the lines from the file. + # See File.readlines. Returns all the lines from the file. # def readlines: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String] | (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String] @@ -957,7 +962,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - readlink() # --> - # See `File.readlink`. Read symbolic link. + # See File.readlink. Read symbolic link. # def readlink: () -> untyped @@ -967,7 +972,7 @@ class Pathname # --> # Returns the real (absolute) pathname of `self` in the actual filesystem. # - # Does not contain symlinks or useless dots, `..` and `.`. + # Does not contain symlinks or useless dots, .. and .. # # The last component of the real pathname can be nonexistent. # @@ -979,7 +984,7 @@ class Pathname # --> # Returns the real (absolute) pathname for `self` in the actual filesystem. # - # Does not contain symlinks or useless dots, `..` and `.`. + # Does not contain symlinks or useless dots, .. and .. # # All components of the pathname must exist when this method is called. # @@ -1026,7 +1031,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - rename(to) # --> - # See `File.rename`. Rename the file. + # See File.rename. Rename the file. # def rename: (Pathname | string new_name) -> 0 @@ -1034,7 +1039,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - rmdir() # --> - # See `Dir.rmdir`. Remove the referenced directory. + # See Dir.rmdir. Remove the referenced directory. # def rmdir: () -> 0 @@ -1046,7 +1051,7 @@ class Pathname # consists of consecutive slashes. # # It doesn't access the filesystem. So it may return `false` for some pathnames - # which points to roots such as `/usr/..`. + # which points to roots such as /usr/... # def root?: () -> bool @@ -1054,7 +1059,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - setgid?() # --> - # See `FileTest.setgid?`. + # See FileTest.setgid?. # def setgid?: () -> bool @@ -1062,7 +1067,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - setuid?() # --> - # See `FileTest.setuid?`. + # See FileTest.setuid?. # def setuid?: () -> bool @@ -1070,7 +1075,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - size() # --> - # See `FileTest.size`. + # See FileTest.size. # def size: () -> Integer @@ -1078,7 +1083,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - size?() # --> - # See `FileTest.size?`. + # See FileTest.size?. # def size?: () -> Integer? @@ -1086,7 +1091,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - socket?() # --> - # See `FileTest.socket?`. + # See FileTest.socket?. # def socket?: () -> untyped @@ -1094,7 +1099,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - split() # --> - # See `File.split`. Returns the #dirname and the #basename in an Array. + # See File.split. Returns the #dirname and the #basename in an + # Array. # def split: () -> [ Pathname, Pathname ] @@ -1102,7 +1108,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - stat() # --> - # See `File.stat`. Returns a `File::Stat` object. + # See File.stat. Returns a File::Stat object. # def stat: () -> File::Stat @@ -1110,7 +1116,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - sticky?() # --> - # See `FileTest.sticky?`. + # See FileTest.sticky?. # def sticky?: () -> untyped @@ -1144,7 +1150,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - symlink?() # --> - # See `FileTest.symlink?`. + # See FileTest.symlink?. # def symlink?: () -> untyped @@ -1152,7 +1158,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - sysopen(...) # --> - # See `File.sysopen`. + # See File.sysopen. # def sysopen: (?String mode, ?Integer perm) -> Integer @@ -1181,7 +1187,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - truncate(length) # --> - # See `File.truncate`. Truncate the file to `length` bytes. + # See File.truncate. Truncate the file to `length` bytes. # def truncate: (Integer length) -> 0 @@ -1189,7 +1195,8 @@ class Pathname # rdoc-file=pathname_builtin.rb # - unlink() # --> - # Removes a file or directory, using `File.unlink` or `Dir.unlink` as necessary. + # Removes a file or directory, using File.unlink or + # Dir.unlink as necessary. # def unlink: () -> Integer @@ -1205,7 +1212,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - utime(atime, mtime) # --> - # See `File.utime`. Update the access and modification times. + # See File.utime. Update the access and modification times. # def utime: (Integer | Time atime, Integer | Time mtime) -> Integer @@ -1213,7 +1220,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - world_readable?() # --> - # See `FileTest.world_readable?`. + # See FileTest.world_readable?. # def world_readable?: () -> (Integer | nil) @@ -1221,7 +1228,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - world_writable?() # --> - # See `FileTest.world_writable?`. + # See FileTest.world_writable?. # def world_writable?: () -> (Integer | nil) @@ -1229,7 +1236,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - writable?() # --> - # See `FileTest.writable?`. + # See FileTest.writable?. # def writable?: () -> bool @@ -1237,7 +1244,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - writable_real?() # --> - # See `FileTest.writable_real?`. + # See FileTest.writable_real?. # def writable_real?: () -> bool @@ -1245,7 +1252,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - write(...) # --> - # Writes `contents` to the file. See `File.write`. + # Writes `contents` to the file. See File.write. # def write: (String content, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> Integer @@ -1253,7 +1260,7 @@ class Pathname # rdoc-file=pathname_builtin.rb # - zero?() # --> - # See `FileTest.zero?`. + # See FileTest.zero?. # def zero?: () -> bool @@ -1276,7 +1283,7 @@ class Pathname # - new(path) # --> # Create a Pathname object from the given String (or String-like object). If - # `path` contains a NUL character (`\0`), an ArgumentError is raised. + # `path` contains a NUL character (\0), an ArgumentError is raised. # def initialize: (string | Pathname) -> void diff --git a/core/proc.rbs b/core/proc.rbs index e1828e123..07c8753ba 100644 --- a/core/proc.rbs +++ b/core/proc.rbs @@ -37,7 +37,7 @@ # # proc2 = proc {|x| x**2 } # -# * Receiving a block of code into proc argument (note the `&`): +# * Receiving a block of code into proc argument (note the &): # # def make_proc(&block) # block @@ -149,7 +149,7 @@ # method. # # Lambda semantics is typically preserved during the proc lifetime, including -# `&`-deconstruction to a block of code: +# &-deconstruction to a block of code: # # p = proc {|x, y| x } # l = lambda {|x, y| x } @@ -184,7 +184,7 @@ # ## Conversion of other objects to procs # # Any object that implements the `to_proc` method can be converted into a proc -# by the `&` operator, and therefore can be consumed by iterators. +# by the & operator, and therefore can be consumed by iterators. # # class Greeter # def initialize(greeting) @@ -389,13 +389,13 @@ class Proc # a_proc.(9, 1, 2, 3) #=> [9, 18, 27] # a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27] # - # Note that `prc.()` invokes `prc.call()` with the parameters given. It's - # syntactic sugar to hide "call". + # Note that prc.() invokes prc.call() with the + # parameters given. It's syntactic sugar to hide "call". # - # For procs created using #lambda or `->()` an error is generated if the wrong - # number of parameters are passed to the proc. For procs created using Proc.new - # or Kernel.proc, extra parameters are silently discarded and missing parameters - # are set to `nil`. + # For procs created using #lambda or ->() an error is generated if + # the wrong number of parameters are passed to the proc. For procs created + # using Proc.new or Kernel.proc, extra parameters are silently discarded and + # missing parameters are set to `nil`. # # a_proc = proc {|a,b| [a,b] } # a_proc.call(1) #=> [1, nil] @@ -418,13 +418,13 @@ class Proc # a_proc.(9, 1, 2, 3) #=> [9, 18, 27] # a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27] # - # Note that `prc.()` invokes `prc.call()` with the parameters given. It's - # syntactic sugar to hide "call". + # Note that prc.() invokes prc.call() with the + # parameters given. It's syntactic sugar to hide "call". # - # For procs created using #lambda or `->()` an error is generated if the wrong - # number of parameters are passed to the proc. For procs created using Proc.new - # or Kernel.proc, extra parameters are silently discarded and missing parameters - # are set to `nil`. + # For procs created using #lambda or ->() an error is generated if + # the wrong number of parameters are passed to the proc. For procs created + # using Proc.new or Kernel.proc, extra parameters are silently discarded and + # missing parameters are set to `nil`. # # a_proc = proc {|a,b| [a,b] } # a_proc.call(1) #=> [1, nil] @@ -545,8 +545,8 @@ class Proc # lambdas and have only a finite number of optional arguments; in this latter # case, returns n. Keyword arguments will be considered as a single additional # argument, that argument being mandatory if any keyword argument is mandatory. - # A #proc with no argument declarations is the same as a block declaring `||` as - # its arguments. + # A #proc with no argument declarations is the same as a block declaring + # || as its arguments. # # proc {}.arity #=> 0 # proc { || }.arity #=> 0 @@ -605,13 +605,13 @@ class Proc # a_proc.(9, 1, 2, 3) #=> [9, 18, 27] # a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27] # - # Note that `prc.()` invokes `prc.call()` with the parameters given. It's - # syntactic sugar to hide "call". + # Note that prc.() invokes prc.call() with the + # parameters given. It's syntactic sugar to hide "call". # - # For procs created using #lambda or `->()` an error is generated if the wrong - # number of parameters are passed to the proc. For procs created using Proc.new - # or Kernel.proc, extra parameters are silently discarded and missing parameters - # are set to `nil`. + # For procs created using #lambda or ->() an error is generated if + # the wrong number of parameters are passed to the proc. For procs created + # using Proc.new or Kernel.proc, extra parameters are silently discarded and + # missing parameters are set to `nil`. # # a_proc = proc {|a,b| [a,b] } # a_proc.call(1) #=> [1, nil] @@ -634,13 +634,13 @@ class Proc # a_proc.(9, 1, 2, 3) #=> [9, 18, 27] # a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27] # - # Note that `prc.()` invokes `prc.call()` with the parameters given. It's - # syntactic sugar to hide "call". + # Note that prc.() invokes prc.call() with the + # parameters given. It's syntactic sugar to hide "call". # - # For procs created using #lambda or `->()` an error is generated if the wrong - # number of parameters are passed to the proc. For procs created using Proc.new - # or Kernel.proc, extra parameters are silently discarded and missing parameters - # are set to `nil`. + # For procs created using #lambda or ->() an error is generated if + # the wrong number of parameters are passed to the proc. For procs created + # using Proc.new or Kernel.proc, extra parameters are silently discarded and + # missing parameters are set to `nil`. # # a_proc = proc {|a,b| [a,b] } # a_proc.call(1) #=> [1, nil] @@ -747,7 +747,7 @@ class Proc # Proc.new {}.lambda? #=> false # # `lambda`, `proc` and Proc.new preserve the tricks of a Proc object given by - # `&` argument. + # & argument. # # lambda(&lambda {}).lambda? #=> true # proc(&lambda {}).lambda? #=> true @@ -757,13 +757,13 @@ class Proc # proc(&proc {}).lambda? #=> false # Proc.new(&proc {}).lambda? #=> false # - # A Proc object generated by `&` argument has the tricks + # A Proc object generated by & argument has the tricks # # def n(&b) b.lambda? end # n {} #=> false # - # The `&` argument preserves the tricks if a Proc object is given by `&` - # argument. + # The & argument preserves the tricks if a Proc object is given by + # & argument. # # n(&lambda {}) #=> true # n(&proc {}) #=> false @@ -836,13 +836,14 @@ class Proc # - proc.ruby2_keywords -> proc # --> # Marks the proc as passing keywords through a normal argument splat. This - # should only be called on procs that accept an argument splat (`*args`) but not - # explicit keywords or a keyword splat. It marks the proc such that if the proc - # is called with keyword arguments, the final hash argument is marked with a - # special flag such that if it is the final element of a normal argument splat - # to another method call, and that method call does not include explicit - # keywords or a keyword splat, the final element is interpreted as keywords. In - # other words, keywords will be passed through the proc to other methods. + # should only be called on procs that accept an argument splat + # (*args) but not explicit keywords or a keyword splat. It marks + # the proc such that if the proc is called with keyword arguments, the final + # hash argument is marked with a special flag such that if it is the final + # element of a normal argument splat to another method call, and that method + # call does not include explicit keywords or a keyword splat, the final element + # is interpreted as keywords. In other words, keywords will be passed through + # the proc to other methods. # # This should only be used for procs that delegate keywords to another method, # and only for backwards compatibility with Ruby versions before 2.7. diff --git a/core/process.rbs b/core/process.rbs index 029cdf374..f6ede0b8d 100644 --- a/core/process.rbs +++ b/core/process.rbs @@ -98,8 +98,8 @@ # What the word "executable" means here is depending on platforms. # # Even if the file considered "executable", its content may not be in proper -# executable format. In that case, Ruby tries to run it by using `/bin/sh` -# on a Unix-like system, like system(3) does. +# executable format. In that case, Ruby tries to run it by using +# /bin/sh on a Unix-like system, like system(3) does. # # File.write('shell_command', 'echo $SHELL', perm: 0o755) # system('./shell_command') # prints "/bin/sh" or something. @@ -157,7 +157,7 @@ # # Optional trailing argument `options` is a hash of execution options. # -# #### Working Directory (`:chdir`) +# #### Working Directory (:chdir) # # By default, the working directory for the new process is the same as that of # the current process: @@ -169,7 +169,8 @@ # # /var # -# Use option `:chdir` to set the working directory for the new process: +# Use option :chdir to set the working directory for the new +# process: # # Process.spawn('ruby -e "puts Dir.pwd"', {chdir: '/tmp'}) # @@ -194,42 +195,43 @@ # # There are these shorthand symbols for fds: # -# * `:in`: Specifies file descriptor 0 (STDIN). -# * `:out`: Specifies file descriptor 1 (STDOUT). -# * `:err`: Specifies file descriptor 2 (STDERR). +# * :in: Specifies file descriptor 0 (STDIN). +# * :out: Specifies file descriptor 1 (STDOUT). +# * :err: Specifies file descriptor 2 (STDERR). # # The value given with a source is one of: # # * *n*: Redirects to fd *n* in the parent process. # * `filepath`: Redirects from or to the file at `filepath` via -# `open(filepath, mode, 0644)`, where `mode` is `'r'` for source `:in`, or -# `'w'` for source `:out` or `:err`. -# * `[filepath]`: Redirects from the file at `filepath` via `open(filepath, -# 'r', 0644)`. -# * `[filepath, mode]`: Redirects from or to the file at `filepath` via -# `open(filepath, mode, 0644)`. -# * `[filepath, mode, perm]`: Redirects from or to the file at `filepath` via -# `open(filepath, mode, perm)`. -# * `[:child, fd]`: Redirects to the redirected `fd`. -# * `:close`: Closes the file descriptor in child process. +# open(filepath, mode, 0644), where `mode` is 'r' +# for source :in, or 'w' for source +# :out or :err. +# * [filepath]: Redirects from the file at `filepath` via +# open(filepath, 'r', 0644). +# * [filepath, mode]: Redirects from or to the file at `filepath` +# via open(filepath, mode, 0644). +# * [filepath, mode, perm]: Redirects from or to the file at +# `filepath` via open(filepath, mode, perm). +# * [:child, fd]: Redirects to the redirected `fd`. +# * :close: Closes the file descriptor in child process. # # See [Access Modes](rdoc-ref:File@Access+Modes) and [File # Permissions](rdoc-ref:File@File+Permissions). # -# #### Environment Variables (`:unsetenv_others`) +# #### Environment Variables (:unsetenv_others) # # By default, the new process inherits environment variables from the parent -# process; use execution option key `:unsetenv_others` with value `true` to -# clear environment variables in the new process. +# process; use execution option key :unsetenv_others with value +# `true` to clear environment variables in the new process. # # Any changes specified by execution option `env` are made after the new process # inherits or clears its environment variables; see [Execution # Environment](rdoc-ref:Process@Execution+Environment). # -# #### File-Creation Access (`:umask`) +# #### File-Creation Access (:umask) # -# Use execution option `:umask` to set the file-creation access for the new -# process; see [Access Modes](rdoc-ref:File@Access+Modes): +# Use execution option :umask to set the file-creation access for +# the new process; see [Access Modes](rdoc-ref:File@Access+Modes): # # command = 'ruby -e "puts sprintf(\"0%o\", File.umask)"' # options = {:umask => 0644} @@ -239,28 +241,29 @@ # # 0644 # -# #### Process Groups (`:pgroup` and `:new_pgroup`) +# #### Process Groups (:pgroup and :new_pgroup) # # By default, the new process belongs to the same [process # group](https://en.wikipedia.org/wiki/Process_group) as the parent process. # -# To specify a different process group. use execution option `:pgroup` with one -# of the following values: +# To specify a different process group. use execution option +# :pgroup with one of the following values: # # * `true`: Create a new process group for the new process. # * *pgid*: Create the new process in the process group whose id is *pgid*. # -# On Windows only, use execution option `:new_pgroup` with value `true` to -# create a new process group for the new process. +# On Windows only, use execution option :new_pgroup with value +# `true` to create a new process group for the new process. # # #### Resource Limits # # Use execution options to set resource limits. # # The keys for these options are symbols of the form -# `:rlimit_resource_name`, where *resource_name* is the downcased form of -# one of the string resource names described at method Process.setrlimit. For -# example, key `:rlimit_cpu` corresponds to resource limit `'CPU'`. +# :rlimit_resource_name, where *resource_name* is the +# downcased form of one of the string resource names described at method +# Process.setrlimit. For example, key :rlimit_cpu corresponds to +# resource limit 'CPU'. # # The value for such as key is one of: # @@ -271,13 +274,14 @@ # # By default, the new process inherits file descriptors from the parent process. # -# Use execution option `:close_others => true` to modify that inheritance by -# closing non-standard fds (3 and greater) that are not otherwise redirected. +# Use execution option :close_others => true to modify that +# inheritance by closing non-standard fds (3 and greater) that are not otherwise +# redirected. # # ### Execution Shell # -# On a Unix-like system, the shell invoked is `/bin/sh`; the entire string -# `command_line` is passed as an argument to [shell option +# On a Unix-like system, the shell invoked is /bin/sh; the entire +# string `command_line` is passed as an argument to [shell option # -c](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/sh. # html). # @@ -295,21 +299,23 @@ # # On Windows, the shell invoked is determined by environment variable # `RUBYSHELL`, if defined, or `COMSPEC` otherwise; the entire string -# `command_line` is passed as an argument to `-c` option for `RUBYSHELL`, as -# well as `/bin/sh`, and [/c +# `command_line` is passed as an argument to -c option for +# `RUBYSHELL`, as well as /bin/sh, and [/c # option](https://learn.microsoft.com/en-us/windows-server/administration/window # s-commands/cmd) for `COMSPEC`. The shell is invoked automatically in the # following cases: # -# * The command is a built-in of `cmd.exe`, such as `echo`. -# * The executable file is a batch file; its name ends with `.bat` or `.cmd`. +# * The command is a built-in of cmd.exe, such as `echo`. +# * The executable file is a batch file; its name ends with .bat +# or .cmd. # # Note that the command will still be invoked as `command_line` form even when -# called in `exe_path` form, because `cmd.exe` does not accept a script name -# like `/bin/sh` does but only works with `/c` option. +# called in `exe_path` form, because cmd.exe does not accept a +# script name like /bin/sh does but only works with /c +# option. # -# The standard shell `cmd.exe` performs environment variable expansion but does -# not have globbing functionality: +# The standard shell cmd.exe performs environment variable +# expansion but does not have globbing functionality: # # Example: # @@ -405,7 +411,7 @@ module Process # - Process._fork -> integer # --> # An internal API for fork. Do not call this method directly. Currently, this is - # called via Kernel#fork, Process.fork, and IO.popen with `"-"`. + # called via Kernel#fork, Process.fork, and IO.popen with "-". # # This method is not for casual code but for application monitoring libraries. # You can add custom code before and after fork events by overriding this @@ -453,17 +459,17 @@ module Process # Process.clock_getres(:CLOCK_PROCESS_CPUTIME_ID, :second) # => 0 # # In addition to the values for `unit` supported in Process.clock_gettime, this - # method supports `:hertz`, the integer number of clock ticks per second (which - # is the reciprocal of `:float_second`): + # method supports :hertz, the integer number of clock ticks per + # second (which is the reciprocal of :float_second): # # Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz) # => 100.0 # Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :float_second) # => 0.01 # # **Accuracy**: Note that the returned resolution may be inaccurate on some # platforms due to underlying bugs. Inaccurate resolutions have been reported - # for various clocks including `:CLOCK_MONOTONIC` and `:CLOCK_MONOTONIC_RAW` on - # Linux, macOS, BSD or AIX platforms, when using ARM processors, or when using - # virtualization. + # for various clocks including :CLOCK_MONOTONIC and + # :CLOCK_MONOTONIC_RAW on Linux, macOS, BSD or AIX platforms, when + # using ARM processors, or when using virtualization. # def self.clock_getres: (Symbol | Integer clock_id, ?Symbol unit) -> (Float | Integer) @@ -482,74 +488,77 @@ module Process # Optional argument `unit` should be a symbol that specifies the unit to be used # in the returned clock time; see below. # - # **Argument `clock_id`** + # Argument `clock_id` # # Argument `clock_id` specifies the clock whose time is to be returned; it may - # be a constant such as `Process::CLOCK_REALTIME`, or a symbol shorthand such as - # `:CLOCK_REALTIME`. + # be a constant such as Process::CLOCK_REALTIME, or a symbol + # shorthand such as :CLOCK_REALTIME. # # The supported clocks depend on the underlying operating system; this method # supports the following clocks on the indicated platforms (raises Errno::EINVAL # if called with an unsupported clock): # - # * `:CLOCK_BOOTTIME`: Linux 2.6.39. - # * `:CLOCK_BOOTTIME_ALARM`: Linux 3.0. - # * `:CLOCK_MONOTONIC`: SUSv3 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, - # OpenBSD 3.4, macOS 10.12, Windows-2000. - # * `:CLOCK_MONOTONIC_COARSE`: Linux 2.6.32. - # * `:CLOCK_MONOTONIC_FAST`: FreeBSD 8.1. - # * `:CLOCK_MONOTONIC_PRECISE`: FreeBSD 8.1. - # * `:CLOCK_MONOTONIC_RAW`: Linux 2.6.28, macOS 10.12. - # * `:CLOCK_MONOTONIC_RAW_APPROX`: macOS 10.12. - # * `:CLOCK_PROCESS_CPUTIME_ID`: SUSv3 to 4, Linux 2.5.63, FreeBSD 9.3, - # OpenBSD 5.4, macOS 10.12. - # * `:CLOCK_PROF`: FreeBSD 3.0, OpenBSD 2.1. - # * `:CLOCK_REALTIME`: SUSv2 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, - # OpenBSD 2.1, macOS 10.12, Windows-8/Server-2012. Time.now is recommended - # over +:CLOCK_REALTIME:. - # * `:CLOCK_REALTIME_ALARM`: Linux 3.0. - # * `:CLOCK_REALTIME_COARSE`: Linux 2.6.32. - # * `:CLOCK_REALTIME_FAST`: FreeBSD 8.1. - # * `:CLOCK_REALTIME_PRECISE`: FreeBSD 8.1. - # * `:CLOCK_SECOND`: FreeBSD 8.1. - # * `:CLOCK_TAI`: Linux 3.10. - # * `:CLOCK_THREAD_CPUTIME_ID`: SUSv3 to 4, Linux 2.5.63, FreeBSD 7.1, OpenBSD - # 5.4, macOS 10.12. - # * `:CLOCK_UPTIME`: FreeBSD 7.0, OpenBSD 5.5. - # * `:CLOCK_UPTIME_FAST`: FreeBSD 8.1. - # * `:CLOCK_UPTIME_PRECISE`: FreeBSD 8.1. - # * `:CLOCK_UPTIME_RAW`: macOS 10.12. - # * `:CLOCK_UPTIME_RAW_APPROX`: macOS 10.12. - # * `:CLOCK_VIRTUAL`: FreeBSD 3.0, OpenBSD 2.1. + # * :CLOCK_BOOTTIME: Linux 2.6.39. + # * :CLOCK_BOOTTIME_ALARM: Linux 3.0. + # * :CLOCK_MONOTONIC: SUSv3 to 4, Linux 2.5.63, FreeBSD 3.0, + # NetBSD 2.0, OpenBSD 3.4, macOS 10.12, Windows-2000. + # * :CLOCK_MONOTONIC_COARSE: Linux 2.6.32. + # * :CLOCK_MONOTONIC_FAST: FreeBSD 8.1. + # * :CLOCK_MONOTONIC_PRECISE: FreeBSD 8.1. + # * :CLOCK_MONOTONIC_RAW: Linux 2.6.28, macOS 10.12. + # * :CLOCK_MONOTONIC_RAW_APPROX: macOS 10.12. + # * :CLOCK_PROCESS_CPUTIME_ID: SUSv3 to 4, Linux 2.5.63, FreeBSD + # 9.3, OpenBSD 5.4, macOS 10.12. + # * :CLOCK_PROF: FreeBSD 3.0, OpenBSD 2.1. + # * :CLOCK_REALTIME: SUSv2 to 4, Linux 2.5.63, FreeBSD 3.0, + # NetBSD 2.0, OpenBSD 2.1, macOS 10.12, Windows-8/Server-2012. Time.now is + # recommended over +:CLOCK_REALTIME:. + # * :CLOCK_REALTIME_ALARM: Linux 3.0. + # * :CLOCK_REALTIME_COARSE: Linux 2.6.32. + # * :CLOCK_REALTIME_FAST: FreeBSD 8.1. + # * :CLOCK_REALTIME_PRECISE: FreeBSD 8.1. + # * :CLOCK_SECOND: FreeBSD 8.1. + # * :CLOCK_TAI: Linux 3.10. + # * :CLOCK_THREAD_CPUTIME_ID: SUSv3 to 4, Linux 2.5.63, FreeBSD + # 7.1, OpenBSD 5.4, macOS 10.12. + # * :CLOCK_UPTIME: FreeBSD 7.0, OpenBSD 5.5. + # * :CLOCK_UPTIME_FAST: FreeBSD 8.1. + # * :CLOCK_UPTIME_PRECISE: FreeBSD 8.1. + # * :CLOCK_UPTIME_RAW: macOS 10.12. + # * :CLOCK_UPTIME_RAW_APPROX: macOS 10.12. + # * :CLOCK_VIRTUAL: FreeBSD 3.0, OpenBSD 2.1. # # Note that SUS stands for Single Unix Specification. SUS contains POSIX and - # clock_gettime is defined in the POSIX part. SUS defines `:CLOCK_REALTIME` as - # mandatory but `:CLOCK_MONOTONIC`, `:CLOCK_PROCESS_CPUTIME_ID`, and - # `:CLOCK_THREAD_CPUTIME_ID` are optional. + # clock_gettime is defined in the POSIX part. SUS defines + # :CLOCK_REALTIME as mandatory but :CLOCK_MONOTONIC, + # :CLOCK_PROCESS_CPUTIME_ID, and + # :CLOCK_THREAD_CPUTIME_ID are optional. # # Certain emulations are used when the given `clock_id` is not supported # directly: # - # * Emulations for `:CLOCK_REALTIME`: + # * Emulations for :CLOCK_REALTIME: # - # * `:GETTIMEOFDAY_BASED_CLOCK_REALTIME`: Use gettimeofday() defined by - # SUS (deprecated in SUSv4). The resolution is 1 microsecond. - # * `:TIME_BASED_CLOCK_REALTIME`: Use time() defined by ISO C. The - # resolution is 1 second. + # * :GETTIMEOFDAY_BASED_CLOCK_REALTIME: Use gettimeofday() + # defined by SUS (deprecated in SUSv4). The resolution is 1 microsecond. + # * :TIME_BASED_CLOCK_REALTIME: Use time() defined by ISO C. + # The resolution is 1 second. # - # * Emulations for `:CLOCK_MONOTONIC`: + # * Emulations for :CLOCK_MONOTONIC: # - # * `:MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC`: Use mach_absolute_time(), - # available on Darwin. The resolution is CPU dependent. - # * `:TIMES_BASED_CLOCK_MONOTONIC`: Use the result value of times() - # defined by POSIX, thus: + # * :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC: Use + # mach_absolute_time(), available on Darwin. The resolution is CPU + # dependent. + # * :TIMES_BASED_CLOCK_MONOTONIC: Use the result value of + # times() defined by POSIX, thus: # > Upon successful completion, times() shall return the elapsed real # time, in clock ticks, since an arbitrary point in the past (for # example, system start-up time). # # > For example, GNU/Linux returns a value based on jiffies and it is # monotonic. However, 4.4BSD uses gettimeofday() and it is not - # monotonic. (FreeBSD uses `:CLOCK_MONOTONIC` instead, though.) + # monotonic. (FreeBSD uses :CLOCK_MONOTONIC instead, + # though.) # # The resolution is the clock tick. "getconf CLK_TCK" command shows the # clock ticks per second. (The clock ticks-per-second is defined by HZ @@ -557,40 +566,40 @@ module Process # type, the resolution is 10 millisecond and cannot represent over 497 # days. # - # * Emulations for `:CLOCK_PROCESS_CPUTIME_ID`: - # - # * `:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID`: Use getrusage() defined - # by SUS. getrusage() is used with RUSAGE_SELF to obtain the time only - # for the calling process (excluding the time for child processes). The - # result is addition of user time (ru_utime) and system time (ru_stime). - # The resolution is 1 microsecond. - # * `:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID`: Use times() defined by POSIX. - # The result is addition of user time (tms_utime) and system time - # (tms_stime). tms_cutime and tms_cstime are ignored to exclude the time - # for child processes. The resolution is the clock tick. "getconf - # CLK_TCK" command shows the clock ticks per second. (The clock ticks - # per second is defined by HZ macro in older systems.) If it is 100, the - # resolution is 10 millisecond. - # * `:CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID`: Use clock() defined by ISO C. - # The resolution is `1/CLOCKS_PER_SEC`. `CLOCKS_PER_SEC` is the C-level - # macro defined by time.h. SUS defines `CLOCKS_PER_SEC` as 1000000; - # other systems may define it differently. If `CLOCKS_PER_SEC` is - # 1000000 (as in SUS), the resolution is 1 microsecond. If - # `CLOCKS_PER_SEC` is 1000000 and clock_t is a 32-bit integer type, it - # cannot represent over 72 minutes. - # - # **Argument `unit`** - # - # Optional argument `unit` (default `:float_second`) specifies the unit for the - # returned value. - # - # * `:float_microsecond`: Number of microseconds as a float. - # * `:float_millisecond`: Number of milliseconds as a float. - # * `:float_second`: Number of seconds as a float. - # * `:microsecond`: Number of microseconds as an integer. - # * `:millisecond`: Number of milliseconds as an integer. - # * `:nanosecond`: Number of nanoseconds as an integer. - # * `:second`: Number of seconds as an integer. + # * Emulations for :CLOCK_PROCESS_CPUTIME_ID: + # + # * :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID: Use + # getrusage() defined by SUS. getrusage() is used with RUSAGE_SELF to + # obtain the time only for the calling process (excluding the time for + # child processes). The result is addition of user time (ru_utime) and + # system time (ru_stime). The resolution is 1 microsecond. + # * :TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID: Use times() + # defined by POSIX. The result is addition of user time (tms_utime) and + # system time (tms_stime). tms_cutime and tms_cstime are ignored to + # exclude the time for child processes. The resolution is the clock + # tick. "getconf CLK_TCK" command shows the clock ticks per second. (The + # clock ticks per second is defined by HZ macro in older systems.) If it + # is 100, the resolution is 10 millisecond. + # * :CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID: Use clock() + # defined by ISO C. The resolution is 1/CLOCKS_PER_SEC. + # `CLOCKS_PER_SEC` is the C-level macro defined by time.h. SUS defines + # `CLOCKS_PER_SEC` as 1000000; other systems may define it differently. + # If `CLOCKS_PER_SEC` is 1000000 (as in SUS), the resolution is 1 + # microsecond. If `CLOCKS_PER_SEC` is 1000000 and clock_t is a 32-bit + # integer type, it cannot represent over 72 minutes. + # + # Argument `unit` + # + # Optional argument `unit` (default :float_second) specifies the + # unit for the returned value. + # + # * :float_microsecond: Number of microseconds as a float. + # * :float_millisecond: Number of milliseconds as a float. + # * :float_second: Number of seconds as a float. + # * :microsecond: Number of microseconds as an integer. + # * :millisecond: Number of milliseconds as an integer. + # * :nanosecond: Number of nanoseconds as an integer. + # * :second: Number of seconds as an integer. # # Examples: # @@ -611,15 +620,15 @@ module Process # # The underlying function, clock_gettime(), returns a number of nanoseconds. # Float object (IEEE 754 double) is not enough to represent the return value for - # `:CLOCK_REALTIME`. If the exact nanoseconds value is required, use - # `:nanosecond` as the `unit`. + # :CLOCK_REALTIME. If the exact nanoseconds value is required, use + # :nanosecond as the `unit`. # # The origin (time zero) of the returned value is system-dependent, and may be, # for example, system start up time, process start up time, the Epoch, etc. # - # The origin in `:CLOCK_REALTIME` is defined as the Epoch: `1970-01-01 00:00:00 - # UTC`; some systems count leap seconds and others don't, so the result may vary - # across systems. + # The origin in :CLOCK_REALTIME is defined as the Epoch: + # 1970-01-01 00:00:00 UTC; some systems count leap seconds and + # others don't, so the result may vary across systems. # def self.clock_gettime: (Symbol | Integer clock_id) -> Float | (Symbol | Integer clock_id, :float_second | :float_millisecond | :float_microsecond unit) -> Float @@ -906,29 +915,29 @@ module Process # # Argument `signal` specifies the signal to be sent; the argument may be: # - # * An integer signal number: e.g., `-29`, `0`, `29`. - # * A signal name (string), with or without leading `'SIG'`, and with or - # without a further prefixed minus sign (`'-'`): e.g.: + # * An integer signal number: e.g., -29, `0`, `29`. + # * A signal name (string), with or without leading 'SIG', and + # with or without a further prefixed minus sign ('-'): e.g.: # - # * `'SIGPOLL'`. - # * `'POLL'`, - # * `'-SIGPOLL'`. - # * `'-POLL'`. + # * 'SIGPOLL'. + # * 'POLL', + # * '-SIGPOLL'. + # * '-POLL'. # - # * A signal symbol, with or without leading `'SIG'`, and with or without a - # further prefixed minus sign (`'-'`): e.g.: + # * A signal symbol, with or without leading 'SIG', and with or + # without a further prefixed minus sign ('-'): e.g.: # - # * `:SIGPOLL`. - # * `:POLL`. - # * `:'-SIGPOLL'`. - # * `:'-POLL'`. + # * :SIGPOLL. + # * :POLL. + # * :'-SIGPOLL'. + # * :'-POLL'. # # If `signal` is: # - # * A non-negative integer, or a signal name or symbol without prefixed `'-'`, - # each process with process ID `id` is signalled. - # * A negative integer, or a signal name or symbol with prefixed `'-'`, each - # process group with group ID `id` is signalled. + # * A non-negative integer, or a signal name or symbol without prefixed + # '-', each process with process ID `id` is signalled. + # * A negative integer, or a signal name or symbol with prefixed + # '-', each process group with group ID `id` is signalled. # # Use method Signal.list to see which signals are supported by Ruby on the # underlying platform; the method returns a hash of the string names and @@ -1064,40 +1073,46 @@ module Process # # Argument `resource` specifies the resource whose limits are to be set; the # argument may be given as a symbol, as a string, or as a constant beginning - # with `Process::RLIMIT_` (e.g., `:CORE`, `'CORE'`, or `Process::RLIMIT_CORE`. + # with Process::RLIMIT_ (e.g., :CORE, + # 'CORE', or Process::RLIMIT_CORE. # # The resources available and supported are system-dependent, and may include # (here expressed as symbols): # - # * `:AS`: Total available memory (bytes) (SUSv3, NetBSD, FreeBSD, OpenBSD - # except 4.4BSD-Lite). - # * `:CORE`: Core size (bytes) (SUSv3). - # * `:CPU`: CPU time (seconds) (SUSv3). - # * `:DATA`: Data segment (bytes) (SUSv3). - # * `:FSIZE`: File size (bytes) (SUSv3). - # * `:MEMLOCK`: Total size for mlock(2) (bytes) (4.4BSD, GNU/Linux). - # * `:MSGQUEUE`: Allocation for POSIX message queues (bytes) (GNU/Linux). - # * `:NICE`: Ceiling on process's nice(2) value (number) (GNU/Linux). - # * `:NOFILE`: File descriptors (number) (SUSv3). - # * `:NPROC`: Number of processes for the user (number) (4.4BSD, GNU/Linux). - # * `:NPTS`: Number of pseudo terminals (number) (FreeBSD). - # * `:RSS`: Resident memory size (bytes) (4.2BSD, GNU/Linux). - # * `:RTPRIO`: Ceiling on the process's real-time priority (number) + # * :AS: Total available memory (bytes) (SUSv3, NetBSD, FreeBSD, + # OpenBSD except 4.4BSD-Lite). + # * :CORE: Core size (bytes) (SUSv3). + # * :CPU: CPU time (seconds) (SUSv3). + # * :DATA: Data segment (bytes) (SUSv3). + # * :FSIZE: File size (bytes) (SUSv3). + # * :MEMLOCK: Total size for mlock(2) (bytes) (4.4BSD, + # GNU/Linux). + # * :MSGQUEUE: Allocation for POSIX message queues (bytes) # (GNU/Linux). - # * `:RTTIME`: CPU time for real-time process (us) (GNU/Linux). - # * `:SBSIZE`: All socket buffers (bytes) (NetBSD, FreeBSD). - # * `:SIGPENDING`: Number of queued signals allowed (signals) (GNU/Linux). - # * `:STACK`: Stack size (bytes) (SUSv3). + # * :NICE: Ceiling on process's nice(2) value (number) + # (GNU/Linux). + # * :NOFILE: File descriptors (number) (SUSv3). + # * :NPROC: Number of processes for the user (number) (4.4BSD, + # GNU/Linux). + # * :NPTS: Number of pseudo terminals (number) (FreeBSD). + # * :RSS: Resident memory size (bytes) (4.2BSD, GNU/Linux). + # * :RTPRIO: Ceiling on the process's real-time priority (number) + # (GNU/Linux). + # * :RTTIME: CPU time for real-time process (us) (GNU/Linux). + # * :SBSIZE: All socket buffers (bytes) (NetBSD, FreeBSD). + # * :SIGPENDING: Number of queued signals allowed (signals) + # (GNU/Linux). + # * :STACK: Stack size (bytes) (SUSv3). # # Arguments `cur_limit` and `max_limit` may be: # # * Integers (`max_limit` should not be smaller than `cur_limit`). - # * Symbol `:SAVED_MAX`, string `'SAVED_MAX'`, or constant - # `Process::RLIM_SAVED_MAX`: saved maximum limit. - # * Symbol `:SAVED_CUR`, string `'SAVED_CUR'`, or constant - # `Process::RLIM_SAVED_CUR`: saved current limit. - # * Symbol `:INFINITY`, string `'INFINITY'`, or constant - # `Process::RLIM_INFINITY`: no limit on resource. + # * Symbol :SAVED_MAX, string 'SAVED_MAX', or + # constant Process::RLIM_SAVED_MAX: saved maximum limit. + # * Symbol :SAVED_CUR, string 'SAVED_CUR', or + # constant Process::RLIM_SAVED_CUR: saved current limit. + # * Symbol :INFINITY, string 'INFINITY', or constant + # Process::RLIM_INFINITY: no limit on resource. # # This example raises the soft limit of core size to the hard limit to try to # make core dump possible: @@ -1164,8 +1179,8 @@ module Process # - Process.wait(pid = -1, flags = 0) -> integer # --> # Waits for a suitable child process to exit, returns its process ID, and sets - # `$?` to a Process::Status object containing information on that process. Which - # child it waits for depends on the value of the given `pid`: + # $? to a Process::Status object containing information on that + # process. Which child it waits for depends on the value of the given `pid`: # # * Positive integer: Waits for the child process whose process ID is `pid`: # @@ -1211,7 +1226,7 @@ module Process # Process.wait(0) returned pid 225788, which is child 0 pid. # Raised Errno::ECHILD, because child 1 process group ID differs from parent process group ID. # - # * `-1` (default): Waits for any child process: + # * -1 (default): Waits for any child process: # # parent_pgpid = Process.getpgid(Process.pid) # puts "Parent process group ID is #{parent_pgpid}." @@ -1243,7 +1258,8 @@ module Process # true # true # - # * Less than `-1`: Waits for any child whose process group ID is `-pid`: + # * Less than -1: Waits for any child whose process group ID is + # -pid: # # parent_pgpid = Process.getpgid(Process.pid) # puts "Parent process group ID is #{parent_pgpid}." @@ -1329,8 +1345,8 @@ module Process # - Process.wait(pid = -1, flags = 0) -> integer # --> # Waits for a suitable child process to exit, returns its process ID, and sets - # `$?` to a Process::Status object containing information on that process. Which - # child it waits for depends on the value of the given `pid`: + # $? to a Process::Status object containing information on that + # process. Which child it waits for depends on the value of the given `pid`: # # * Positive integer: Waits for the child process whose process ID is `pid`: # @@ -1376,7 +1392,7 @@ module Process # Process.wait(0) returned pid 225788, which is child 0 pid. # Raised Errno::ECHILD, because child 1 process group ID differs from parent process group ID. # - # * `-1` (default): Waits for any child process: + # * -1 (default): Waits for any child process: # # parent_pgpid = Process.getpgid(Process.pid) # puts "Parent process group ID is #{parent_pgpid}." @@ -1408,7 +1424,8 @@ module Process # true # true # - # * Less than `-1`: Waits for any child whose process group ID is `-pid`: + # * Less than -1: Waits for any child whose process group ID is + # -pid: # # parent_pgpid = Process.getpgid(Process.pid) # puts "Parent process group ID is #{parent_pgpid}." @@ -1483,13 +1500,14 @@ module Process # running applications. # # This method is expected to be called at the end of the application boot. If - # the application is deployed using a pre-forking model, `Process.warmup` should - # be called in the original process before the first fork. + # the application is deployed using a pre-forking model, + # Process.warmup should be called in the original process before + # the first fork. # # The actual optimizations performed are entirely implementation specific and # may change in the future without notice. # - # On CRuby, `Process.warmup`: + # On CRuby, Process.warmup: # # * Performs a major GC. # * Compacts the heap. @@ -1832,9 +1850,9 @@ end # # A Process::Status contains information about a system process. # -# Thread-local variable `$?` is initially `nil`. Some methods assign to it a -# Process::Status object that represents a system process (either running or -# terminated): +# Thread-local variable $? is initially `nil`. Some methods assign +# to it a Process::Status object that represents a system process (either +# running or terminated): # # `ruby -e "exit 99"` # stat = $? # => # @@ -1912,8 +1930,8 @@ class Process::Status < Object # rdoc-file=process.c # - exited? -> true or false # --> - # Returns `true` if the process exited normally (for example using an `exit()` - # call or finishing the program), `false` if not. + # Returns `true` if the process exited normally (for example using an + # exit() call or finishing the program), `false` if not. # def exited?: () -> bool @@ -2108,8 +2126,8 @@ module Process::Sys # - Process::Sys.setregid(rid, eid) -> nil # --> # Sets the (group) real and/or effective group IDs of the current process to - # *rid* and *eid*, respectively. A value of `-1` for either means to leave that - # ID unchanged. Not available on all platforms. + # *rid* and *eid*, respectively. A value of -1 for either means to + # leave that ID unchanged. Not available on all platforms. # def self.setregid: (Integer rid, Integer eid) -> nil @@ -2118,8 +2136,8 @@ module Process::Sys # - Process::Sys.setresgid(rid, eid, sid) -> nil # --> # Sets the (group) real, effective, and saved user IDs of the current process to - # *rid*, *eid*, and *sid* respectively. A value of `-1` for any value means to - # leave that ID unchanged. Not available on all platforms. + # *rid*, *eid*, and *sid* respectively. A value of -1 for any value + # means to leave that ID unchanged. Not available on all platforms. # def self.setresgid: (Integer rid, Integer eid, Integer sid) -> nil @@ -2128,8 +2146,8 @@ module Process::Sys # - Process::Sys.setresuid(rid, eid, sid) -> nil # --> # Sets the (user) real, effective, and saved user IDs of the current process to - # *rid*, *eid*, and *sid* respectively. A value of `-1` for any value means to - # leave that ID unchanged. Not available on all platforms. + # *rid*, *eid*, and *sid* respectively. A value of -1 for any value + # means to leave that ID unchanged. Not available on all platforms. # def self.setresuid: (Integer rid, Integer eid, Integer sid) -> nil @@ -2138,8 +2156,8 @@ module Process::Sys # - Process::Sys.setreuid(rid, eid) -> nil # --> # Sets the (user) real and/or effective user IDs of the current process to *rid* - # and *eid*, respectively. A value of `-1` for either means to leave that ID - # unchanged. Not available on all platforms. + # and *eid*, respectively. A value of -1 for either means to leave + # that ID unchanged. Not available on all platforms. # def self.setreuid: (Integer rid, Integer eid) -> nil diff --git a/core/ractor.rbs b/core/ractor.rbs index 3ebf79541..4619f4b6b 100644 --- a/core/ractor.rbs +++ b/core/ractor.rbs @@ -96,8 +96,9 @@ # object. # # Deep cloning of objects may be slow, and sometimes impossible. Alternatively, -# `move: true` may be used during sending. This will *move* the unshareable -# object to the receiving ractor, making it inaccessible to the sending ractor. +# move: true may be used during sending. This will *move* the +# unshareable object to the receiving ractor, making it inaccessible to the +# sending ractor. # # data = ['foo', 'bar'] # r = Ractor.new do @@ -171,8 +172,8 @@ # # I see C # # can not access instance variables of classes/modules from non-main Ractors (RuntimeError) # -# See also the description of `# shareable_constant_value` pragma in [Comments -# syntax](rdoc-ref:syntax/comments.rdoc) explanation. +# See also the description of # shareable_constant_value pragma in +# [Comments syntax](rdoc-ref:syntax/comments.rdoc) explanation. # # ## Ractors vs threads # @@ -392,9 +393,10 @@ class Ractor # # r1 done # # r0 done # - # The following example is almost equivalent to `ractors.map(&:value)` except - # the thread is unblocked when any of the ractors has terminated as opposed to - # waiting for their termination in the array element order. + # The following example is almost equivalent to + # ractors.map(&:value) except the thread is unblocked when any of + # the ractors has terminated as opposed to waiting for their termination in the + # array element order. # # values = [] # until ractors.empty? @@ -425,8 +427,8 @@ class Ractor # - Ractor.shareable_proc(self: nil){} -> shareable proc # --> # Returns a shareable copy of the given block's Proc. The value of `self` in the - # Proc will be replaced with the value passed via the `self:` keyword, or `nil` - # if not given. + # Proc will be replaced with the value passed via the self: + # keyword, or `nil` if not given. # # In a shareable Proc, access to any outer variables if prohibited. # @@ -539,8 +541,10 @@ class Ractor # Registers the port as a monitoring port for this ractor. When the ractor # terminates, the port receives a Symbol object. # - # * `:exited` is sent if the ractor terminates without an unhandled exception. - # * `:aborted` is sent if the ractor terminates by an unhandled exception. + # * :exited is sent if the ractor terminates without an unhandled + # exception. + # * :aborted is sent if the ractor terminates by an unhandled + # exception. # # r = Ractor.new{ some_task() } # r.monitor(port = Ractor::Port.new) diff --git a/core/random.rbs b/core/random.rbs index b7cca5f60..3c4655fd3 100644 --- a/core/random.rbs +++ b/core/random.rbs @@ -190,9 +190,10 @@ end # # ## Random number formatter. # -# Formats generated random numbers in many manners. When `'random/formatter'` is -# required, several methods are added to empty core module `Random::Formatter`, -# making them available as Random's instance and module methods. +# Formats generated random numbers in many manners. When +# 'random/formatter' is required, several methods are added to +# empty core module Random::Formatter, making them available as +# Random's instance and module methods. # # Standard library SecureRandom is also extended with the module, and the # methods described below are available as a module methods in it. diff --git a/core/range.rbs b/core/range.rbs index 09838ed5f..11d1a531f 100644 --- a/core/range.rbs +++ b/core/range.rbs @@ -98,8 +98,9 @@ # ## Ranges and Other Classes # # An object may be put into a range if its class implements instance method -# `#<=>`. Ruby core classes that do so include Array, Complex, File::Stat, -# Float, Integer, Kernel, Module, Numeric, Rational, String, Symbol, and Time. +# #<=>. Ruby core classes that do so include Array, Complex, +# File::Stat, Float, Integer, Kernel, Module, Numeric, Rational, String, Symbol, +# and Time. # # Example: # @@ -128,12 +129,13 @@ # ## Ranges and User-Defined Classes # # A user-defined class that is to be used in a range must implement instance -# method `#<=>`; see Integer#<=>. To make iteration available, it must also -# implement instance method `succ`; see Integer#succ. +# method #<=>; see Integer#<=>. To make iteration available, it +# must also implement instance method `succ`; see Integer#succ. # -# The class below implements both `#<=>` and `succ`, and so can be used both to -# construct ranges and to iterate over them. Note that the Comparable module is -# included so the `==` method is defined in terms of `#<=>`. +# The class below implements both #<=> and `succ`, and so can be +# used both to construct ranges and to iterate over them. Note that the +# Comparable module is included so the == method is defined in +# terms of #<=>. # # # Represent a string of 'X' characters. # class Xs @@ -268,9 +270,9 @@ class Range[out Elem] < Object # Returns `true` if and only if: # # * `other` is a range. - # * `other.begin == self.begin`. - # * `other.end == self.end`. - # * `other.exclude_end? == self.exclude_end?`. + # * other.begin == self.begin. + # * other.end == self.end. + # * other.exclude_end? == self.exclude_end?. # # Otherwise returns `false`. # @@ -297,8 +299,8 @@ class Range[out Elem] < Object # rdoc-file=range.c # - self === object -> true or false # --> - # Returns `true` if `object` is between `self.begin` and `self.end`. `false` - # otherwise: + # Returns `true` if `object` is between self.begin and + # self.end. `false` otherwise: # # (1..4) === 2 # => true # (1..4) === 5 # => false @@ -308,7 +310,7 @@ class Range[out Elem] < Object # ('a'..'d') === 'c' # => true # ('a'..'d') === 'e' # => false # - # A case statement uses method `===`, and so: + # A case statement uses method ===, and so: # # case 79 # when (1..50) @@ -364,10 +366,11 @@ class Range[out Elem] < Object # --> # Returns `true` if the given argument is within `self`, `false` otherwise. # - # With non-range argument `object`, evaluates with `<=` and `<`. + # With non-range argument `object`, evaluates with <= and + # <. # - # For range `self` with included end value (`#exclude_end? == false`), evaluates - # thus: + # For range `self` with included end value (#exclude_end? == + # false), evaluates thus: # # self.begin <= object <= self.end # @@ -387,8 +390,8 @@ class Range[out Elem] < Object # r.cover?('e') # => false # r.cover?(0) # => false # - # For range `r` with excluded end value (`#exclude_end? == true`), evaluates - # thus: + # For range `r` with excluded end value (#exclude_end? == true), + # evaluates thus: # # r.begin <= object < r.end # @@ -434,8 +437,8 @@ class Range[out Elem] < Object # Returns `false` if either: # # * The begin value of `self` is larger than its end value. - # * An internal call to `#<=>` returns `nil`; that is, the operands are not - # comparable. + # * An internal call to #<=> returns `nil`; that is, the operands + # are not comparable. # # Beginless ranges cover all values of the same type before the end, excluding # the end for exclusive ranges. Beginless ranges cover ranges that end before @@ -493,7 +496,7 @@ class Range[out Elem] < Object # (1..4).each {|element| a.push(element) } # => 1..4 # a # => [1, 2, 3, 4] # - # Raises an exception unless `self.first.respond_to?(:succ)`. + # Raises an exception unless self.first.respond_to?(:succ). # # With no block given, returns an enumerator. # @@ -556,7 +559,7 @@ class Range[out Elem] < Object # - hash -> integer # --> # Returns the integer hash value for `self`. Two range objects `r0` and `r1` - # have the same hash value if and only if `r0.eql?(r1)`. + # have the same hash value if and only if r0.eql?(r1). # # Related: Range#eql?, Object#hash. # @@ -608,8 +611,8 @@ class Range[out Elem] < Object # rdoc-file=range.c # - inspect -> string # --> - # Returns a string representation of `self`, including `begin.inspect` and - # `end.inspect`: + # Returns a string representation of `self`, including + # begin.inspect and end.inspect: # # (1..4).inspect # => "1..4" # (1...4).inspect # => "1...4" @@ -668,8 +671,8 @@ class Range[out Elem] < Object # - max {|a, b| ... } -> object # - max(n) {|a, b| ... } -> array # --> - # Returns the maximum value in `self`, using method `#<=>` or a given block for - # comparison. + # Returns the maximum value in `self`, using method #<=> or a given + # block for comparison. # # With no argument and no block given, returns the maximum-valued element of # `self`. @@ -736,7 +739,7 @@ class Range[out Elem] < Object # # Raises an exception if either: # - # * `self` is a endless range: `(1..)`. + # * `self` is a endless range: (1..). # * A block is given and `self` is a beginless range. # # Related: Range#min, Range#minmax. @@ -750,8 +753,8 @@ class Range[out Elem] < Object # - min {|a, b| ... } -> object # - min(n) {|a, b| ... } -> array # --> - # Returns the minimum value in `self`, using method `#<=>` or a given block for - # comparison. + # Returns the minimum value in `self`, using method #<=> or a given + # block for comparison. # # With no argument and no block given, returns the minimum-valued element of # `self`. @@ -818,7 +821,7 @@ class Range[out Elem] < Object # # Raises an exception if either: # - # * `self` is a beginless range: `(..4)`. + # * `self` is a beginless range: (..4). # * A block is given and `self` is an endless range. # # Related: Range#max, Range#minmax. @@ -831,10 +834,10 @@ class Range[out Elem] < Object # - minmax {|a, b| ... } -> [object, object] # --> # Returns a 2-element array containing the minimum and maximum value in `self`, - # either according to comparison method `#<=>` or a given block. + # either according to comparison method #<=> or a given block. # - # With no block given, returns the minimum and maximum values, using `#<=>` for - # comparison: + # With no block given, returns the minimum and maximum values, using + # #<=> for comparison: # # (1..4).minmax # => [1, 4] # (1...4).minmax # => [1, 3] @@ -847,12 +850,13 @@ class Range[out Elem] < Object # * Zero if `a` and `b` are equal. # * Positive if `a` is larger than `b`. # - # The block is called `self.size` times to compare elements; returns a 2-element - # Array containing the minimum and maximum values from `self`, per the block: + # The block is called self.size times to compare elements; returns + # a 2-element Array containing the minimum and maximum values from `self`, per + # the block: # # (1..4).minmax {|a, b| -(a <=> b) } # => [4, 1] # - # Returns `[nil, nil]` if: + # Returns [nil, nil] if: # # * The begin value of the range is larger than the end value: # @@ -884,8 +888,8 @@ class Range[out Elem] < Object # # (1..3).overlap?(1) # TypeError # - # Returns `false` if an internal call to `#<=>` returns `nil`; that is, the - # operands are not comparable. + # Returns `false` if an internal call to #<=> returns `nil`; that + # is, the operands are not comparable. # # (1..3).overlap?('a'..'d') # => false # @@ -929,7 +933,8 @@ class Range[out Elem] < Object # (...[]).overlap?(...[]) # => true # # Even if those ranges are effectively empty (no number can be smaller than - # `-Float::INFINITY`), they are still considered overlapping with themselves. + # -Float::INFINITY), they are still considered overlapping with + # themselves. # # Related: Range#cover?. # @@ -1019,7 +1024,7 @@ class Range[out Elem] < Object # - step(s = 1) -> enumerator/arithmetic_sequence # --> # Iterates over the elements of range in steps of `s`. The iteration is - # performed by `+` operator: + # performed by + operator: # # (0..6).step(2) { puts _1 } #=> 1..5 # # Prints: 0, 2, 4, 6 @@ -1034,8 +1039,8 @@ class Range[out Elem] < Object # # 2022-02-28 00:00:00 UTC # # 2022-03-01 00:00:00 UTC # - # If ` + step` decreases the value, iteration is still performed when step - # `begin` is higher than the `end`: + # If + step decreases the value, iteration is still performed when + # step `begin` is higher than the `end`: # # (0..6).step(-2) { puts _1 } # # Prints nothing @@ -1100,8 +1105,8 @@ class Range[out Elem] < Object # rdoc-file=range.c # - to_s -> string # --> - # Returns a string representation of `self`, including `begin.to_s` and - # `end.to_s`: + # Returns a string representation of `self`, including begin.to_s + # and end.to_s: # # (1..4).to_s # => "1..4" # (1...4).to_s # => "1...4" @@ -1124,9 +1129,9 @@ class Range[out Elem] < Object # Returns `true` if and only if: # # * `other` is a range. - # * `other.begin.eql?(self.begin)`. - # * `other.end.eql?(self.end)`. - # * `other.exclude_end? == self.exclude_end?`. + # * other.begin.eql?(self.begin). + # * other.end.eql?(self.end). + # * other.exclude_end? == self.exclude_end?. # # Otherwise returns `false`. # diff --git a/core/rational.rbs b/core/rational.rbs index 0779f8ce9..5abca095e 100644 --- a/core/rational.rbs +++ b/core/rational.rbs @@ -161,7 +161,7 @@ class Rational < Numeric # # Returns: # - # * `-1`, if `self` is less than `other`. + # * -1, if `self` is less than `other`. # * `0`, if the two values are the same. # * `1`, if `self` is greater than `other`. # * `nil`, if the two values are incomparable. @@ -216,7 +216,7 @@ class Rational < Numeric # `ndigits` decimal digits (default: 0). # # When the precision is negative, the returned value is an integer with at least - # `ndigits.abs` trailing zeros. + # ndigits.abs trailing zeros. # # Returns a rational when `ndigits` is positive, otherwise returns an integer. # @@ -272,7 +272,7 @@ class Rational < Numeric # `ndigits` decimal digits (default: 0). # # When the precision is negative, the returned value is an integer with at least - # `ndigits.abs` trailing zeros. + # ndigits.abs trailing zeros. # # Returns a rational when `ndigits` is positive, otherwise returns an integer. # @@ -392,7 +392,7 @@ class Rational < Numeric # decimal digits (default: 0). # # When the precision is negative, the returned value is an integer with at least - # `ndigits.abs` trailing zeros. + # ndigits.abs trailing zeros. # # Returns a rational when `ndigits` is positive, otherwise returns an integer. # @@ -482,7 +482,7 @@ class Rational < Numeric # digits (default: 0). # # When the precision is negative, the returned value is an integer with at least - # `ndigits.abs` trailing zeros. + # ndigits.abs trailing zeros. # # Returns a rational when `ndigits` is positive, otherwise returns an integer. # diff --git a/core/rbs/unnamed/argf.rbs b/core/rbs/unnamed/argf.rbs index d2ca18293..b44cc38b4 100644 --- a/core/rbs/unnamed/argf.rbs +++ b/core/rbs/unnamed/argf.rbs @@ -4,7 +4,7 @@ module RBS # ## ARGF and `ARGV` # # The ARGF object works with the array at global variable `ARGV` to make - # `$stdin` and file streams available in the Ruby program: + # $stdin and file streams available in the Ruby program: # # * **ARGV** may be thought of as the **argument vector** array. # @@ -13,9 +13,9 @@ module RBS # # * **ARGF** may be thought of as the **argument files** object. # - # It can access file streams and/or the `$stdin` stream, based on what it - # finds in `ARGV`. This provides a convenient way for the command line to - # specify streams for a Ruby program to read. + # It can access file streams and/or the $stdin stream, based on + # what it finds in `ARGV`. This provides a convenient way for the command + # line to specify streams for a Ruby program to read. # # ## Reading # @@ -24,16 +24,16 @@ module RBS # # ### Simplest Case # - # When the *very first* ARGF read occurs with an empty `ARGV` (`[]`), the source - # is `$stdin`: + # When the *very first* ARGF read occurs with an empty `ARGV` ([]), + # the source is $stdin: # - # * File `t.rb`: + # * File t.rb: # # p ['ARGV', ARGV] # p ['ARGF.read', ARGF.read] # - # * Commands and outputs (see below for the content of files `foo.txt` and - # `bar.txt`): + # * Commands and outputs (see below for the content of files + # foo.txt and bar.txt): # # $ echo "Open the pod bay doors, Hal." | ruby t.rb # ["ARGV", []] @@ -45,7 +45,8 @@ module RBS # # ### About the Examples # - # Many examples here assume the existence of files `foo.txt` and `bar.txt`: + # Many examples here assume the existence of files foo.txt and + # bar.txt: # # $ cat foo.txt # Foo 0 @@ -66,19 +67,20 @@ module RBS # one of: # # * The string path to a file that may be opened as a stream. - # * The character `'-'`, meaning stream `$stdin`. + # * The character '-', meaning stream $stdin. # # Each element that is *not* one of these should be removed from `ARGV` before # ARGF accesses that source. # # In the following example: # - # * Filepaths `foo.txt` and `bar.txt` may be retained as potential sources. - # * Options `--xyzzy` and `--mojo` should be removed. + # * Filepaths foo.txt and bar.txt may be retained as + # potential sources. + # * Options --xyzzy and --mojo should be removed. # # Example: # - # * File `t.rb`: + # * File t.rb: # # # Print arguments (and options, if any) found on command line. # p ['ARGV', ARGV] @@ -90,7 +92,7 @@ module RBS # # ARGF's stream access considers the elements of `ARGV`, left to right: # - # * File `t.rb`: + # * File t.rb: # # p "ARGV: #{ARGV}" # p "Read: #{ARGF.read}" # Read everything from all specified streams. @@ -112,7 +114,7 @@ module RBS # Each element in `ARGV` is removed when its corresponding source is accessed; # when all sources have been accessed, the array is empty: # - # * File `t.rb`: + # * File t.rb: # # until ARGV.empty? && ARGF.eof? # p "ARGV: #{ARGV}" @@ -142,7 +144,7 @@ module RBS # This program prints what it reads from files at the paths specified on the # command line: # - # * File `t.rb`: + # * File t.rb: # # p ['ARGV', ARGV] # # Read and print all content from the specified sources. @@ -154,11 +156,12 @@ module RBS # ["ARGV", [foo.txt, bar.txt] # ["ARGF.read", "Foo 0\nFoo 1\nBar 0\nBar 1\nBar 2\nBar 3\n"] # - # #### Specifying `$stdin` in `ARGV` + # #### Specifying $stdin in `ARGV` # - # To specify stream `$stdin` in `ARGV`, us the character `'-'`: + # To specify stream $stdin in `ARGV`, us the character + # '-': # - # * File `t.rb`: + # * File t.rb: # # p ['ARGV', ARGV] # p ['ARGF.read', ARGF.read] @@ -169,8 +172,9 @@ module RBS # ["ARGV", ["-"]] # ["ARGF.read", "Open the pod bay doors, Hal.\n"] # - # When no character `'-'` is given, stream `$stdin` is ignored (exception: see - # [Specifying $stdin in ARGV](rdoc-ref:ARGF@Specifying+-24stdin+in+ARGV)): + # When no character '-' is given, stream $stdin is + # ignored (exception: see [Specifying $stdin in + # ARGV](rdoc-ref:ARGF@Specifying+-24stdin+in+ARGV)): # # * Command and output: # @@ -181,7 +185,7 @@ module RBS # #### Mixtures and Repetitions in `ARGV` # # For an ARGF reader, `ARGV` may contain any mixture of filepaths and character - # `'-'`, including repetitions. + # '-', including repetitions. # # #### Modifications to `ARGV` # @@ -208,13 +212,13 @@ module RBS # ### About Enumerable # # ARGF includes module Enumerable. Virtually all methods in Enumerable call - # method `#each` in the including class. + # method #each in the including class. # # **Note well**: In ARGF, method #each returns data from the *sources*, *not* - # from `ARGV`; therefore, for example, `ARGF#entries` returns an array of lines - # from the sources, not an array of the strings from `ARGV`: + # from `ARGV`; therefore, for example, ARGF#entries returns an + # array of lines from the sources, not an array of the strings from `ARGV`: # - # * File `t.rb`: + # * File t.rb: # # p ['ARGV', ARGV] # p ['ARGF.entries', ARGF.entries] @@ -521,8 +525,8 @@ module RBS # rdoc-file=io.c # - ARGF.file -> IO or File object # --> - # Returns the current file as an IO or File object. `$stdin` is returned when - # the current file is STDIN. + # Returns the current file as an IO or File object. $stdin is + # returned when the current file is STDIN. # # For example: # @@ -630,8 +634,9 @@ module RBS # --> # Returns the next line from the current file in ARGF. # - # By default lines are assumed to be separated by `$/`; to use a different - # character as a separator, supply it as a String for the *sep* argument. + # By default lines are assumed to be separated by $/; to use a + # different character as a separator, supply it as a String for the *sep* + # argument. # # The optional *limit* argument specifies how many characters of each line to # return. By default all characters are returned. @@ -647,7 +652,7 @@ module RBS # --> # Returns the file extension appended to the names of backup copies of modified # files under in-place edit mode. This value can be set using ARGF.inplace_mode= - # or passing the `-i` switch to the Ruby binary. + # or passing the -i switch to the Ruby binary. # %a{annotate:rdoc:copy:ARGF#inplace_mode} def inplace_mode: () -> String? @@ -668,8 +673,9 @@ module RBS # print line.sub("foo","bar") # end # - # First, *file.txt.bak* is created as a backup copy of *file.txt*. Then, each - # line of *file.txt* has the first occurrence of "foo" replaced with "bar". + # First, file.txt.bak is created as a backup copy of file.txt. + # Then, each line of file.txt has the first occurrence of "foo" + # replaced with "bar". # %a{annotate:rdoc:copy:ARGF#inplace_mode=} def inplace_mode=: (String) -> self @@ -684,10 +690,10 @@ module RBS # object. # # If ARGF.set_encoding has been called with two encoding names, the second is - # returned. Otherwise, if `Encoding.default_external` has been set, that value - # is returned. Failing that, if a default external encoding was specified on the - # command-line, that value is used. If the encoding is unknown, `nil` is - # returned. + # returned. Otherwise, if Encoding.default_external has been set, + # that value is returned. Failing that, if a default external encoding was + # specified on the command-line, that value is used. If the encoding is unknown, + # `nil` is returned. # %a{annotate:rdoc:copy:ARGF#internal_encoding} def internal_encoding: () -> Encoding @@ -778,15 +784,15 @@ module RBS # - print(*objects) -> nil # --> # Writes the given objects to the stream; returns `nil`. Appends the output - # record separator `$OUTPUT_RECORD_SEPARATOR` (`$\`), if it is not `nil`. See - # [Line IO](rdoc-ref:IO@Line+IO). + # record separator $OUTPUT_RECORD_SEPARATOR ($\), if + # it is not `nil`. See [Line IO](rdoc-ref:IO@Line+IO). # # With argument `objects` given, for each object: # # * Converts via its method `to_s` if not a string. # * Writes to the stream. # * If not the last object, writes the output field separator - # `$OUTPUT_FIELD_SEPARATOR` (`$,`) if it is not `nil`. + # $OUTPUT_FIELD_SEPARATOR ($,) if it is not `nil`. # # With default separators: # @@ -818,8 +824,8 @@ module RBS # # "0,0.0,0/1,0+0i,zero,zero\n" # - # With no argument given, writes the content of `$_` (which is usually the most - # recent user input): + # With no argument given, writes the content of $_ (which is + # usually the most recent user input): # # f = File.open('t.tmp', 'w+') # gets # Sets $_ to the most recent user input. @@ -871,13 +877,13 @@ module RBS # newline sequence. If called without arguments, writes a newline. See [Line # IO](rdoc-ref:IO@Line+IO). # - # Note that each added newline is the character `"\n", not the output - # record separator ($\`). + # Note that each added newline is the character "\n", not the output + # record separator ($\). # # Treatment for each object: # # * String: writes the string. - # * Neither string nor array: writes `object.to_s`. + # * Neither string nor array: writes object.to_s. # * Array: writes each element of the array; arrays may be nested. # # To keep these examples brief, we define this helper method: @@ -930,7 +936,7 @@ module RBS # conversion is applied, if applicable. A string is returned even if EOF is # encountered before any data is read. # - # If *length* is zero, it returns an empty string (`""`). + # If *length* is zero, it returns an empty string (""). # # If the optional *outbuf* argument is present, it must reference a String, # which will receive the data. The *outbuf* will contain only the received data @@ -1015,8 +1021,9 @@ module RBS # --> # Returns the next line from the current file in ARGF. # - # By default lines are assumed to be separated by `$/`; to use a different - # character as a separator, supply it as a String for the *sep* argument. + # By default lines are assumed to be separated by $/; to use a + # different character as a separator, supply it as a String for the *sep* + # argument. # # The optional *limit* argument specifies how many characters of each line to # return. By default all characters are returned. @@ -1041,7 +1048,7 @@ module RBS # lines = ARGF.readlines # lines[0] #=> "This is line one\n" # - # See `IO.readlines` for a full description of all options. + # See IO.readlines for a full description of all options. # %a{annotate:rdoc:copy:ARGF#readlines} def readlines: (?String sep, ?Integer limit, ?chomp: boolish) -> ::Array[String] @@ -1161,7 +1168,7 @@ module RBS # lines = ARGF.readlines # lines[0] #=> "This is line one\n" # - # See `IO.readlines` for a full description of all options. + # See IO.readlines for a full description of all options. # %a{annotate:rdoc:copy:ARGF#to_a} def to_a: (?String sep, ?Integer limit) -> ::Array[String] diff --git a/core/rbs/unnamed/env_class.rbs b/core/rbs/unnamed/env_class.rbs index 8245d3363..fce43234d 100644 --- a/core/rbs/unnamed/env_class.rbs +++ b/core/rbs/unnamed/env_class.rbs @@ -34,7 +34,7 @@ module RBS # ENV[''] = '0' # # Raises Errno::EINVAL (Invalid argument - ruby_setenv()) # - # * May not contain character `"="`: + # * May not contain character "=": # ENV['='] = '0' # # Raises Errno::EINVAL (Invalid argument - ruby_setenv(=)) # @@ -47,7 +47,7 @@ module RBS # ENV[Object.new] = '0' # # Raises TypeError (no implicit conversion of Object into String) # - # * May not contain the NUL character `"\0"`: + # * May not contain the NUL character "\0": # # ENV['foo'] = "\0" # # Raises ArgumentError (bad environment variable value: contains null byte) @@ -156,7 +156,7 @@ module RBS # * ::to_a: Returns the entries as an array of 2-element Arrays. # * ::to_h: Returns a hash of entries selected by the block. # * ::to_hash: Returns a hash of all entries. - # * ::to_s: Returns the string `'ENV'`. + # * ::to_s: Returns the string 'ENV'. # * ::values: Returns all values as an array. # * ::values_at: Returns an array of the values for the given name. # @@ -1001,11 +1001,12 @@ module RBS # ENV.include?('baz') # => false # # Returns `false` if `name` is the empty String or is a String containing - # character `'='`: + # character '=': # ENV.include?('') # => false # ENV.include?('=') # => false # - # Raises an exception if `name` is a String containing the NUL character `"\0"`: + # Raises an exception if `name` is a String containing the NUL character + # "\0": # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte) # # Raises an exception if `name` has an encoding that is not ASCII-compatible: @@ -1034,11 +1035,12 @@ module RBS # ENV.include?('baz') # => false # # Returns `false` if `name` is the empty String or is a String containing - # character `'='`: + # character '=': # ENV.include?('') # => false # ENV.include?('=') # => false # - # Raises an exception if `name` is a String containing the NUL character `"\0"`: + # Raises an exception if `name` is a String containing the NUL character + # "\0": # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte) # # Raises an exception if `name` has an encoding that is not ASCII-compatible: @@ -1067,11 +1069,12 @@ module RBS # ENV.include?('baz') # => false # # Returns `false` if `name` is the empty String or is a String containing - # character `'='`: + # character '=': # ENV.include?('') # => false # ENV.include?('=') # => false # - # Raises an exception if `name` is a String containing the NUL character `"\0"`: + # Raises an exception if `name` is a String containing the NUL character + # "\0": # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte) # # Raises an exception if `name` has an encoding that is not ASCII-compatible: @@ -1132,11 +1135,12 @@ module RBS # ENV.include?('baz') # => false # # Returns `false` if `name` is the empty String or is a String containing - # character `'='`: + # character '=': # ENV.include?('') # => false # ENV.include?('=') # => false # - # Raises an exception if `name` is a String containing the NUL character `"\0"`: + # Raises an exception if `name` is a String containing the NUL character + # "\0": # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte) # # Raises an exception if `name` has an encoding that is not ASCII-compatible: @@ -1173,9 +1177,10 @@ module RBS # variable. # # Returns `nil` if `name` is the empty String or is a String containing - # character `'='`. + # character '='. # - # Raises an exception if `name` is a String containing the NUL character `"\0"`: + # Raises an exception if `name` is a String containing the NUL character + # "\0": # ENV.assoc("\0") # Raises ArgumentError (bad environment variable name: contains null byte) # # Raises an exception if `name` has an encoding that is not ASCII-compatible: diff --git a/core/rbs/unnamed/random.rbs b/core/rbs/unnamed/random.rbs index 252372f6b..ae39be350 100644 --- a/core/rbs/unnamed/random.rbs +++ b/core/rbs/unnamed/random.rbs @@ -38,7 +38,7 @@ module RBS # rand(1.5) # => 0 # # When `range` is a Range, `rand` returns a random number where - # `range.member?(number) == true`. + # range.member?(number) == true. # # prng.rand(5..9) # => one of [5, 6, 7, 8, 9] # prng.rand(5...9) # => one of [5, 6, 7, 8] @@ -46,7 +46,8 @@ module RBS # prng.rand(5.0...9.0) # => between 5.0 and 9.0, excluding 9.0 # # Both the beginning and ending values of the range must respond to subtract - # (`-`) and add (`+`)methods, or rand will raise an ArgumentError. + # (-) and add (+)methods, or rand will raise an + # ArgumentError. # %a{annotate:rdoc:copy:Random#rand} def rand: (?0) -> Float @@ -87,9 +88,10 @@ module RBS # # ## Random number formatter. # - # Formats generated random numbers in many manners. When `'random/formatter'` is - # required, several methods are added to empty core module `Random::Formatter`, - # making them available as Random's instance and module methods. + # Formats generated random numbers in many manners. When + # 'random/formatter' is required, several methods are added to + # empty core module Random::Formatter, making them available as + # Random's instance and module methods. # # Standard library SecureRandom is also extended with the module, and the # methods described below are available as a module methods in it. diff --git a/core/regexp.rbs b/core/regexp.rbs index 2f3acfbaa..f5f298258 100644 --- a/core/regexp.rbs +++ b/core/regexp.rbs @@ -63,7 +63,7 @@ # # This is a very common usage. # /foo/ # => /foo/ # -# * A `%r` regexp literal (see [%r: Regexp +# * A %r regexp literal (see [%r: Regexp # Literals](rdoc-ref:syntax/literals.rdoc@25r-3A+Regexp+Literals)): # # # Same delimiter character at beginning and end; @@ -89,7 +89,7 @@ # 'food'.match(/foo/) # => # # 'food'.match(/bar/) # => nil # -# ## Operator `=~` +# ## Operator =~ # # Each of the operators Regexp#=~, String#=~, and Symbol#=~ returns an integer # offset if a match was found, `nil` otherwise; each also sets [global @@ -99,7 +99,7 @@ # 'foo bar' =~ /bar/ # => 4 # /baz/ =~ 'foo bar' # => nil # -# ## Method `match?` +# ## Method match? # # Each of the methods Regexp#match?, String#match?, and Symbol#match? returns # `true` if a match was found, `false` otherwise; none sets [global @@ -112,22 +112,24 @@ # # Certain regexp-oriented methods assign values to global variables: # -# * `#match`: see [Method match](rdoc-ref:Regexp@Method+match). -# * `#=~`: see [Operator =~](rdoc-ref:Regexp@Operator+-3D~). +# * #match: see [Method match](rdoc-ref:Regexp@Method+match). +# * #=~: see [Operator =~](rdoc-ref:Regexp@Operator+-3D~). # # The affected global variables are: # -# * `$~`: Returns a MatchData object, or `nil`. -# * `$&`: Returns the matched part of the string, or `nil`. -# * `$``: Returns the part of the string to the left of the match, or `nil`. -# * `$'`: Returns the part of the string to the right of the match, or `nil`. -# * `$+`: Returns the last group matched, or `nil`. -# * `$1`, `$2`, etc.: Returns the first, second, etc., matched group, or -# `nil`. Note that `$0` is quite different; it returns the name of the -# currently executing program. +# * $~: Returns a MatchData object, or `nil`. +# * $&: Returns the matched part of the string, or `nil`. +# * $`: Returns the part of the string to the left of the match, +# or `nil`. +# * $': Returns the part of the string to the right of the match, +# or `nil`. +# * $+: Returns the last group matched, or `nil`. +# * $1, $2, etc.: Returns the first, second, etc., +# matched group, or `nil`. Note that $0 is quite different; it +# returns the name of the currently executing program. # -# These variables, except for `$~`, are shorthands for methods of `$~`. See -# MatchData@Global+variables+equivalence. +# These variables, except for $~, are shorthands for methods of +# $~. See MatchData@Global+variables+equivalence. # # Examples: # @@ -228,8 +230,9 @@ # see [Shorthand Character # Classes](rdoc-ref:Regexp@Shorthand+Character+Classes). # -# * `\s` in an ordinary string literal is equivalent to a space character; in -# a source literal, it's shorthand for matching a whitespace character. +# * \s in an ordinary string literal is equivalent to a space +# character; in a source literal, it's shorthand for matching a whitespace +# character. # * In an ordinary string literal, these are (needlessly) escaped characters; # in a source literal, they are shorthands for various matching characters: # @@ -254,16 +257,19 @@ # /[a-f]/.match('foo') # => # # /[a-cd-f]/.match('foo') # => # # -# When the first character of a character class is a caret (`^`), the sense of -# the class is inverted: it matches any character *except* those specified. +# When the first character of a character class is a caret (^), the +# sense of the class is inverted: it matches any character *except* those +# specified. # # /[^a-eg-z]/.match('f') # => # # # A character class may contain another character class. By itself this isn't -# useful because `[a-z[0-9]]` describes the same set as `[a-z0-9]`. +# useful because [a-z[0-9]] describes the same set as +# [a-z0-9]. # -# However, character classes also support the `&&` operator, which performs set -# intersection on its arguments. The two can be combined as follows: +# However, character classes also support the && operator, which +# performs set intersection on its arguments. The two can be combined as +# follows: # # /[a-w&&[^c-g]z]/ # ([a-w] AND ([^c-g] OR z)) # @@ -276,59 +282,66 @@ # Each of the following metacharacters serves as a shorthand for a character # class: # -# * `/./`: Matches any character except a newline: +# * /./: Matches any character except a newline: # # /./.match('foo') # => # # /./.match("\n") # => nil # -# * `/./m`: Matches any character, including a newline; see [Multiline -# Mode](rdoc-ref:Regexp@Multiline+Mode): +# * /./m: Matches any character, including a newline; see +# [Multiline Mode](rdoc-ref:Regexp@Multiline+Mode): # # /./m.match("\n") # => # # -# * `/\w/`: Matches a word character: equivalent to `[a-zA-Z0-9_]`: +# * /\w/: Matches a word character: equivalent to +# [a-zA-Z0-9_]: # # /\w/.match(' foo') # => # # /\w/.match(' _') # => # # /\w/.match(' ') # => nil # -# * `/\W/`: Matches a non-word character: equivalent to `[^a-zA-Z0-9_]`: +# * /\W/: Matches a non-word character: equivalent to +# [^a-zA-Z0-9_]: # # /\W/.match(' ') # => # # /\W/.match('_') # => nil # -# * `/\d/`: Matches a digit character: equivalent to `[0-9]`: +# * /\d/: Matches a digit character: equivalent to +# [0-9]: # # /\d/.match('THX1138') # => # # /\d/.match('foo') # => nil # -# * `/\D/`: Matches a non-digit character: equivalent to `[^0-9]`: +# * /\D/: Matches a non-digit character: equivalent to +# [^0-9]: # # /\D/.match('123Jump!') # => # # /\D/.match('123') # => nil # -# * `/\h/`: Matches a hexdigit character: equivalent to `[0-9a-fA-F]`: +# * /\h/: Matches a hexdigit character: equivalent to +# [0-9a-fA-F]: # # /\h/.match('xyz fedcba9876543210') # => # # /\h/.match('xyz') # => nil # -# * `/\H/`: Matches a non-hexdigit character: equivalent to `[^0-9a-fA-F]`: +# * /\H/: Matches a non-hexdigit character: equivalent to +# [^0-9a-fA-F]: # # /\H/.match('fedcba9876543210xyz') # => # # /\H/.match('fedcba9876543210') # => nil # -# * `/\s/`: Matches a whitespace character: equivalent to `/[ \t\r\n\f\v]/`: +# * /\s/: Matches a whitespace character: equivalent to /[ +# \t\r\n\f\v]/: # # /\s/.match('foo bar') # => # # /\s/.match('foo') # => nil # -# * `/\S/`: Matches a non-whitespace character: equivalent to `/[^ -# \t\r\n\f\v]/`: +# * /\S/: Matches a non-whitespace character: equivalent to +# /[^ \t\r\n\f\v]/: # # /\S/.match(" \t\r\n\f\v foo") # => # # /\S/.match(" \t\r\n\f\v") # => nil # -# * `/\R/`: Matches a linebreak, platform-independently: +# * /\R/: Matches a linebreak, platform-independently: # # /\R/.match("\r") # => # # Carriage return (CR) # /\R/.match("\n") # => # # Newline (LF) @@ -355,47 +368,47 @@ # # Each of these anchors matches a boundary: # -# * `^`: Matches the beginning of a line: +# * ^: Matches the beginning of a line: # # /^bar/.match("foo\nbar") # => # # /^ar/.match("foo\nbar") # => nil # -# * `$`: Matches the end of a line: +# * $: Matches the end of a line: # # /bar$/.match("foo\nbar") # => # # /ba$/.match("foo\nbar") # => nil # -# * `\A`: Matches the beginning of the string: +# * \A: Matches the beginning of the string: # # /\Afoo/.match('foo bar') # => # # /\Afoo/.match(' foo bar') # => nil # -# * `\Z`: Matches the end of the string; if string ends with a single newline, -# it matches just before the ending newline: +# * \Z: Matches the end of the string; if string ends with a +# single newline, it matches just before the ending newline: # # /foo\Z/.match('bar foo') # => # # /foo\Z/.match('foo bar') # => nil # /foo\Z/.match("bar foo\n") # => # # /foo\Z/.match("bar foo\n\n") # => nil # -# * `\z`: Matches the end of the string: +# * \z: Matches the end of the string: # # /foo\z/.match('bar foo') # => # # /foo\z/.match('foo bar') # => nil # /foo\z/.match("bar foo\n") # => nil # -# * `\b`: Matches word boundary when not inside brackets; matches backspace -# (`"0x08"`) when inside brackets: +# * \b: Matches word boundary when not inside brackets; matches +# backspace ("0x08") when inside brackets: # # /foo\b/.match('foo bar') # => # # /foo\b/.match('foobar') # => nil # -# * `\B`: Matches non-word boundary: +# * \B: Matches non-word boundary: # # /foo\B/.match('foobar') # => # # /foo\B/.match('foo bar') # => nil # -# * `\G`: Matches first matching position: +# * \G: Matches first matching position: # # In methods like String#gsub and String#scan, it changes on each iteration. # It initially matches the beginning of subject, and in each following @@ -414,26 +427,27 @@ # # Lookahead anchors: # -# * `(?=_pat_)`: Positive lookahead assertion: ensures that the following -# characters match *pat*, but doesn't include those characters in the -# matched substring. -# -# * `(?!_pat_)`: Negative lookahead assertion: ensures that the following -# characters *do not* match *pat*, but doesn't include those characters in +# * (?=_pat_): Positive lookahead assertion: ensures that the +# following characters match *pat*, but doesn't include those characters in # the matched substring. # +# * (?!_pat_): Negative lookahead assertion: ensures that the +# following characters *do not* match *pat*, but doesn't include those +# characters in the matched substring. +# # Lookbehind anchors: # -# * `(?<=_pat_)`: Positive lookbehind assertion: ensures that the preceding -# characters match *pat*, but doesn't include those characters in the -# matched substring. +# * (?<=_pat_): Positive lookbehind assertion: ensures that the +# preceding characters match *pat*, but doesn't include those characters in +# the matched substring. # -# * `(?(?: Negative lookbehind assertion: ensures that the +# preceding characters do not match *pat*, but doesn't include those +# characters in the matched substring. # # The pattern below uses positive lookahead and positive lookbehind to match -# text appearing in ``...`` tags without including the tags in the match: +# text appearing in ... tags without including +# the tags in the match: # # /(?<=)\w+(?=<\/b>)/.match("Fortune favors the bold.") # # => # @@ -443,15 +457,15 @@ # # #### Match-Reset Anchor # -# * `\K`: Match reset: the matched content preceding `\K` in the regexp is -# excluded from the result. For example, the following two regexps are -# almost equivalent: +# * \K: Match reset: the matched content preceding +# \K in the regexp is excluded from the result. For example, +# the following two regexps are almost equivalent: # # /ab\Kc/.match('abc') # => # # /(?<=ab)c/.match('abc') # => # # -# These match same string and `$&` equals `'c'`, while the matched position -# is different. +# These match same string and $& equals 'c', while +# the matched position is different. # # As are the following two regexps: # @@ -460,9 +474,9 @@ # # ### Alternation # -# The vertical bar metacharacter (`|`) may be used within parentheses to express -# alternation: two or more subexpressions any of which may match the target -# string. +# The vertical bar metacharacter (|) may be used within parentheses +# to express alternation: two or more subexpressions any of which may match the +# target string. # # Two alternatives: # @@ -494,7 +508,7 @@ # # An added *quantifier* specifies how many matches are required or allowed: # -# * `*` - Matches zero or more times: +# * * - Matches zero or more times: # # /\w*/.match('') # # => # @@ -503,39 +517,39 @@ # /\w*/.match('xyz') # # => # # -# * `+` - Matches one or more times: +# * + - Matches one or more times: # # /\w+/.match('') # => nil # /\w+/.match('x') # => # # /\w+/.match('xyz') # => # # -# * `?` - Matches zero or one times: +# * ? - Matches zero or one times: # # /\w?/.match('') # => # # /\w?/.match('x') # => # # /\w?/.match('xyz') # => # # -# * `{`*n*`}` - Matches exactly *n* times: +# * {*n*} - Matches exactly *n* times: # # /\w{2}/.match('') # => nil # /\w{2}/.match('x') # => nil # /\w{2}/.match('xyz') # => # # -# * `{`*min*`,}` - Matches *min* or more times: +# * {*min*,} - Matches *min* or more times: # # /\w{2,}/.match('') # => nil # /\w{2,}/.match('x') # => nil # /\w{2,}/.match('xy') # => # # /\w{2,}/.match('xyz') # => # # -# * `{,`*max*`}` - Matches *max* or fewer times: +# * {,*max*} - Matches *max* or fewer times: # # /\w{,2}/.match('') # => # # /\w{,2}/.match('x') # => # # /\w{,2}/.match('xyz') # => # # -# * `{`*min*`,`*max*`}` - Matches at least *min* times and at most *max* -# times: +# * {*min*,*max*} - Matches at least +# *min* times and at most *max* times: # # /\w{1,2}/.match('') # => nil # /\w{1,2}/.match('x') # => # @@ -546,14 +560,17 @@ # Quantifier matching may be greedy, lazy, or possessive: # # * In *greedy* matching, as many occurrences as possible are matched while -# still allowing the overall match to succeed. Greedy quantifiers: `*`, `+`, -# `?`, `{min, max}` and its variants. +# still allowing the overall match to succeed. Greedy quantifiers: +# *, +, ?, {min, max} +# and its variants. # * In *lazy* matching, the minimum number of occurrences are matched. Lazy -# quantifiers: `*?`, `+?`, `??`, `{min, max}?` and its variants. +# quantifiers: *?, +?, ??, +# {min, max}? and its variants. # * In *possessive* matching, once a match is found, there is no backtracking; # that match is retained, even if it jeopardises the overall match. -# Possessive quantifiers: `*+`, `++`, `?+`. Note that `{min, max}` and its -# variants do *not* support possessive matching. +# Possessive quantifiers: *+, ++, ?+. +# Note that {min, max} and its variants do *not* support +# possessive matching. # # More: # @@ -577,8 +594,9 @@ # re.match('1943-02-04').size # => 1 # re.match('foo') # => nil # -# Adding one or more pairs of parentheses, `(_subexpression_)`, defines -# *groups*, which may result in multiple matched substrings, called *captures*: +# Adding one or more pairs of parentheses, (_subexpression_), +# defines *groups*, which may result in multiple matched substrings, called +# *captures*: # # re = /(\d\d\d\d)-(\d\d)-(\d\d)/ # re.match('1943-02-04') # => # @@ -619,7 +637,7 @@ # have a quantifier), but its matching substring is not included among the # captures. # -# A non-capturing group begins with `?:` (inside the parentheses): +# A non-capturing group begins with ?: (inside the parentheses): # # # Don't capture the year. # re = /(?:\d\d\d\d)-(\d\d)-(\d\d)/ @@ -649,12 +667,14 @@ # # * For a large number of groups: # -# * The ordinary `\_n_` notation applies only for *n* in range (1..9). -# * The `MatchData[_n_]` notation applies for any non-negative *n*. +# * The ordinary \_n_ notation applies only for *n* in range +# (1..9). +# * The MatchData[_n_] notation applies for any non-negative +# *n*. # -# * `\0` is a special backreference, referring to the entire matched string; -# it may not be used within the regexp itself, but may be used outside it -# (for example, in a substitution method call): +# * \0 is a special backreference, referring to the entire +# matched string; it may not be used within the regexp itself, but may be +# used outside it (for example, in a substitution method call): # # 'The cat sat in the hat'.gsub(/[csh]at/, '\0s') # # => "The cats sats in the hats" @@ -662,8 +682,8 @@ # #### Named Captures # # As seen above, a capture can be referred to by its number. A capture can also -# have a name, prefixed as `?<_name_>` or `?'_name_'`, and the name (symbolized) -# may be used as an index in `MatchData[]`: +# have a name, prefixed as ?<_name_> or ?'_name_', and +# the name (symbolized) may be used as an index in MatchData[]: # # md = /\$(?\d+)\.(?'cents'\d+)/.match("$3.67") # # => # @@ -677,14 +697,14 @@ # /\$(?\d+)\.(\d+)/.match("$3.67") # # => # # -# A named group may be backreferenced as `\k<_name_>`: +# A named group may be backreferenced as \k<_name_>: # # /(?[aeiou]).\k.\k/.match('ototomy') # # => # # # When (and only when) a regexp contains named capture groups and appears before -# the `=~` operator, the captured substrings are assigned to local variables -# with corresponding names: +# the =~ operator, the captured substrings are assigned to local +# variables with corresponding names: # # /\$(?\d+)\.(?\d+)/ =~ '$3.67' # dollars # => "3" @@ -695,7 +715,8 @@ # # #### Atomic Grouping # -# A group may be made *atomic* with `(?>`*subexpression*`)`. +# A group may be made *atomic* with +# (?>*subexpression*). # # This causes the subexpression to be matched independently of the rest of the # expression, so that the matched substring becomes fixed for the remainder of @@ -712,19 +733,19 @@ # # Analysis: # -# 1. The leading subexpression `"` in the pattern matches the first character -# `"` in the target string. -# 2. The next subexpression `.*` matches the next substring `Quote"` (including -# the trailing double-quote). +# 1. The leading subexpression " in the pattern matches the first +# character " in the target string. +# 2. The next subexpression .* matches the next substring +# Quote" (including the trailing double-quote). # 3. Now there is nothing left in the target string to match the trailing -# subexpression `"` in the pattern; this would cause the overall match to -# fail. +# subexpression " in the pattern; this would cause the overall +# match to fail. # 4. The matched substring is backtracked by one position: `Quote`. -# 5. The final subexpression `"` now matches the final substring `"`, and the -# overall match succeeds. +# 5. The final subexpression " now matches the final substring +# ", and the overall match succeeds. # -# If subexpression `.*` is grouped atomically, the backtracking is disabled, and -# the overall match fails: +# If subexpression .* is grouped atomically, the backtracking is +# disabled, and the overall match fails: # # /"(?>.*)"/.match('"Quote"') # => nil # @@ -733,9 +754,10 @@ # # #### Subexpression Calls # -# As seen above, a backreference number (`\_n_`) or name (`\k<_name_>`) gives -# access to a captured *substring*; the corresponding regexp *subexpression* may -# also be accessed, via the number (`\\gn`) or name (`\g<_name_>`): +# As seen above, a backreference number (\_n_) or name +# (\k<_name_>) gives access to a captured *substring*; the +# corresponding regexp *subexpression* may also be accessed, via the number +# (\gn) or name (\g<_name_>): # # /\A(?\(\g*\))*\z/.match('(())') # # ^1 @@ -753,15 +775,15 @@ # # 1. Matches at the beginning of the string, i.e. before the first character. # 2. Enters a named group `paren`. -# 3. Matches the first character in the string, `'('`. +# 3. Matches the first character in the string, '('. # 4. Calls the `paren` group again, i.e. recurses back to the second step. # 5. Re-enters the `paren` group. -# 6. Matches the second character in the string, `'('`. +# 6. Matches the second character in the string, '('. # 7. Attempts to call `paren` a third time, but fails because doing so would # prevent an overall successful match. -# 8. Matches the third character in the string, `')'`; marks the end of the -# second recursive call -# 9. Matches the fourth character in the string, `')'`. +# 8. Matches the third character in the string, ')'; marks the end +# of the second recursive call +# 9. Matches the fourth character in the string, ')'. # 10. Matches the end of the string. # # See [Subexpression @@ -770,12 +792,13 @@ # # #### Conditionals # -# The conditional construct takes the form `(?(_cond_)_yes_|_no_)`, where: +# The conditional construct takes the form (?(_cond_)_yes_|_no_), +# where: # # * *cond* may be a capture number or name. # * The match to be applied is *yes* if *cond* is captured; otherwise the # match to be applied is *no*. -# * If not needed, `|_no_` may be omitted. +# * If not needed, |_no_ may be omitted. # # Examples: # @@ -804,19 +827,20 @@ # # #### Unicode Properties # -# The `/\p{_property_name_}/` construct (with lowercase `p`) matches characters -# using a Unicode property name, much like a character class; property `Alpha` -# specifies alphabetic characters: +# The /\p{_property_name_}/ construct (with lowercase `p`) matches +# characters using a Unicode property name, much like a character class; +# property `Alpha` specifies alphabetic characters: # # /\p{Alpha}/.match('a') # => # # /\p{Alpha}/.match('1') # => nil # -# A property can be inverted by prefixing the name with a caret character (`^`): +# A property can be inverted by prefixing the name with a caret character +# (^): # # /\p{^Alpha}/.match('1') # => # # /\p{^Alpha}/.match('a') # => nil # -# Or by using `\P` (uppercase `P`): +# Or by using \P (uppercase `P`): # # /\P{Alpha}/.match('1') # => # # /\P{Alpha}/.match('a') # => nil @@ -826,28 +850,30 @@ # # Some commonly-used properties correspond to POSIX bracket expressions: # -# * `/\p{Alnum}/`: Alphabetic and numeric character -# * `/\p{Alpha}/`: Alphabetic character -# * `/\p{Blank}/`: Space or tab -# * `/\p{Cntrl}/`: Control character -# * `/\p{Digit}/`: Digit characters, and similar) -# * `/\p{Lower}/`: Lowercase alphabetical character -# * `/\p{Print}/`: Like `\p{Graph}`, but includes the space character -# * `/\p{Punct}/`: Punctuation character -# * `/\p{Space}/`: Whitespace character (`[:blank:]`, newline, carriage -# return, etc.) -# * `/\p{Upper}/`: Uppercase alphabetical -# * `/\p{XDigit}/`: Digit allowed in a hexadecimal number (i.e., 0-9a-fA-F) +# * /\p{Alnum}/: Alphabetic and numeric character +# * /\p{Alpha}/: Alphabetic character +# * /\p{Blank}/: Space or tab +# * /\p{Cntrl}/: Control character +# * /\p{Digit}/: Digit characters, and similar) +# * /\p{Lower}/: Lowercase alphabetical character +# * /\p{Print}/: Like \p{Graph}, but includes the +# space character +# * /\p{Punct}/: Punctuation character +# * /\p{Space}/: Whitespace character ([:blank:], +# newline, carriage return, etc.) +# * /\p{Upper}/: Uppercase alphabetical +# * /\p{XDigit}/: Digit allowed in a hexadecimal number (i.e., +# 0-9a-fA-F) # # These are also commonly used: # -# * `/\p{Emoji}/`: Unicode emoji. -# * `/\p{Graph}/`: Characters excluding `/\p{Cntrl}/` and `/\p{Space}/`. Note -# that invisible characters under the Unicode -# ["Format"](https://www.compart.com/en/unicode/category/Cf) category are -# included. -# * `/\p{Word}/`: A member in one of these Unicode character categories (see -# below) or having one of these Unicode properties: +# * /\p{Emoji}/: Unicode emoji. +# * /\p{Graph}/: Characters excluding /\p{Cntrl}/ +# and /\p{Space}/. Note that invisible characters under the +# Unicode ["Format"](https://www.compart.com/en/unicode/category/Cf) +# category are included. +# * /\p{Word}/: A member in one of these Unicode character +# categories (see below) or having one of these Unicode properties: # # * Unicode categories: # * `Mark` (`M`). @@ -858,9 +884,10 @@ # * `Alpha` # * `Join_Control` # -# * `/\p{ASCII}/`: A character in the ASCII character set. -# * `/\p{Any}/`: Any Unicode character (including unassigned characters). -# * `/\p{Assigned}/`: An assigned character. +# * /\p{ASCII}/: A character in the ASCII character set. +# * /\p{Any}/: Any Unicode character (including unassigned +# characters). +# * /\p{Assigned}/: An assigned character. # # #### Unicode Character Categories # @@ -950,68 +977,73 @@ # expressions provide a portable alternative to the above, with the added # benefit of encompassing non-ASCII characters: # -# * `/\d/` matches only ASCII decimal digits `0` through `9`. -# * `/[[:digit:]]/` matches any character in the Unicode `Decimal Number` -# (`Nd`) category; see below. +# * /\d/ matches only ASCII decimal digits `0` through `9`. +# * /[[:digit:]]/ matches any character in the Unicode `Decimal +# Number` (`Nd`) category; see below. # # The POSIX bracket expressions: # -# * `/[[:digit:]]/`: Matches a [Unicode +# * /[[:digit:]]/: Matches a [Unicode # digit](https://www.compart.com/en/unicode/category/Nd): # # /[[:digit:]]/.match('9') # => # # /[[:digit:]]/.match("\u1fbf9") # => # # -# * `/[[:xdigit:]]/`: Matches a digit allowed in a hexadecimal number; -# equivalent to `[0-9a-fA-F]`. +# * /[[:xdigit:]]/: Matches a digit allowed in a hexadecimal +# number; equivalent to [0-9a-fA-F]. # -# * `/[[:upper:]]/`: Matches a [Unicode uppercase +# * /[[:upper:]]/: Matches a [Unicode uppercase # letter](https://www.compart.com/en/unicode/category/Lu): # # /[[:upper:]]/.match('A') # => # # /[[:upper:]]/.match("\u00c6") # => # # -# * `/[[:lower:]]/`: Matches a [Unicode lowercase +# * /[[:lower:]]/: Matches a [Unicode lowercase # letter](https://www.compart.com/en/unicode/category/Ll): # # /[[:lower:]]/.match('a') # => # # /[[:lower:]]/.match("\u01fd") # => # # -# * `/[[:alpha:]]/`: Matches `/[[:upper:]]/` or `/[[:lower:]]/`. +# * /[[:alpha:]]/: Matches /[[:upper:]]/ or +# /[[:lower:]]/. # -# * `/[[:alnum:]]/`: Matches `/[[:alpha:]]/` or `/[[:digit:]]/`. +# * /[[:alnum:]]/: Matches /[[:alpha:]]/ or +# /[[:digit:]]/. # -# * `/[[:space:]]/`: Matches [Unicode space +# * /[[:space:]]/: Matches [Unicode space # character](https://www.compart.com/en/unicode/category/Zs): # # /[[:space:]]/.match(' ') # => # # /[[:space:]]/.match("\u2005") # => # # -# * `/[[:blank:]]/`: Matches `/[[:space:]]/` or tab character: +# * /[[:blank:]]/: Matches /[[:space:]]/ or tab +# character: # # /[[:blank:]]/.match(' ') # => # # /[[:blank:]]/.match("\u2005") # => # # /[[:blank:]]/.match("\t") # => # # -# * `/[[:cntrl:]]/`: Matches [Unicode control +# * /[[:cntrl:]]/: Matches [Unicode control # character](https://www.compart.com/en/unicode/category/Cc): # # /[[:cntrl:]]/.match("\u0000") # => # # /[[:cntrl:]]/.match("\u009f") # => # # -# * `/[[:graph:]]/`: Matches any character except `/[[:space:]]/` or -# `/[[:cntrl:]]/`. +# * /[[:graph:]]/: Matches any character except +# /[[:space:]]/ or /[[:cntrl:]]/. # -# * `/[[:print:]]/`: Matches `/[[:graph:]]/` or space character. +# * /[[:print:]]/: Matches /[[:graph:]]/ or space +# character. # -# * `/[[:punct:]]/`: Matches any (Unicode punctuation +# * /[[:punct:]]/: Matches any (Unicode punctuation # character}[https://www.compart.com/en/unicode/category/Po]: # # Ruby also supports these (non-POSIX) bracket expressions: # -# * `/[[:ascii:]]/`: Matches a character in the ASCII character set. -# * `/[[:word:]]/`: Matches a character in one of these Unicode character -# categories or having one of these Unicode properties: +# * /[[:ascii:]]/: Matches a character in the ASCII character +# set. +# * /[[:word:]]/: Matches a character in one of these Unicode +# character categories or having one of these Unicode properties: # # * Unicode categories: # * `Mark` (`M`). @@ -1024,9 +1056,9 @@ # # ### Comments # -# A comment may be included in a regexp pattern using the `(?#`*comment*`)` -# construct, where *comment* is a substring that is to be ignored. arbitrary -# text ignored by the regexp engine: +# A comment may be included in a regexp pattern using the +# (?#*comment*) construct, where *comment* is a +# substring that is to be ignored. arbitrary text ignored by the regexp engine: # # /foo(?#Ignore me)bar/.match('foobar') # => # # @@ -1038,22 +1070,26 @@ # # Each of these modifiers sets a mode for the regexp: # -# * `i`: `/_pattern_/i` sets [Case-Insensitive +# * `i`: /_pattern_/i sets [Case-Insensitive # Mode](rdoc-ref:Regexp@Case-Insensitive+Mode). -# * `m`: `/_pattern_/m` sets [Multiline Mode](rdoc-ref:Regexp@Multiline+Mode). -# * `x`: `/_pattern_/x` sets [Extended Mode](rdoc-ref:Regexp@Extended+Mode). -# * `o`: `/_pattern_/o` sets [Interpolation +# * `m`: /_pattern_/m sets [Multiline +# Mode](rdoc-ref:Regexp@Multiline+Mode). +# * `x`: /_pattern_/x sets [Extended +# Mode](rdoc-ref:Regexp@Extended+Mode). +# * `o`: /_pattern_/o sets [Interpolation # Mode](rdoc-ref:Regexp@Interpolation+Mode). # # Any, all, or none of these may be applied. # # Modifiers `i`, `m`, and `x` may be applied to subexpressions: # -# * `(?_modifier_)` turns the mode "on" for ensuing subexpressions -# * `(?-_modifier_)` turns the mode "off" for ensuing subexpressions -# * `(?_modifier_:_subexp_)` turns the mode "on" for *subexp* within the group -# * `(?-_modifier_:_subexp_)` turns the mode "off" for *subexp* within the -# group +# * (?_modifier_) turns the mode "on" for ensuing subexpressions +# * (?-_modifier_) turns the mode "off" for ensuing +# subexpressions +# * (?_modifier_:_subexp_) turns the mode "on" for *subexp* +# within the group +# * (?-_modifier_:_subexp_) turns the mode "off" for *subexp* +# within the group # # Example: # @@ -1088,7 +1124,8 @@ # # The multiline-mode in Ruby is what is commonly called a "dot-all mode": # -# * Without the `m` modifier, the subexpression `.` does not match newlines: +# * Without the `m` modifier, the subexpression . does not match +# newlines: # # /a.c/.match("a\nc") # => nil # @@ -1096,16 +1133,17 @@ # # /a.c/m.match("a\nc") # => # # -# Unlike other languages, the modifier `m` does not affect the anchors `^` and -# `$`. These anchors always match at line-boundaries in Ruby. +# Unlike other languages, the modifier `m` does not affect the anchors +# ^ and $. These anchors always match at +# line-boundaries in Ruby. # # ### Extended Mode # # Modifier `x` enables extended mode, which means that: # # * Literal white space in the pattern is to be ignored. -# * Character `#` marks the remainder of its containing line as a comment, -# which is also to be ignored for matching purposes. +# * Character # marks the remainder of its containing line as a +# comment, which is also to be ignored for matching purposes. # # In extended mode, whitespace and comments may be used to form a # self-documented regexp. @@ -1168,22 +1206,22 @@ # A regular expression containing non-US-ASCII characters is assumed to use the # source encoding. This can be overridden with one of the following modifiers. # -# * `/_pat_/n`: US-ASCII if only containing US-ASCII characters, otherwise -# ASCII-8BIT: +# * /_pat_/n: US-ASCII if only containing US-ASCII characters, +# otherwise ASCII-8BIT: # # /foo/n.encoding # => # # /foo\xff/n.encoding # => # # /foo\x7f/n.encoding # => # # -# * `/_pat_/u`: UTF-8 +# * /_pat_/u: UTF-8 # # /foo/u.encoding # => # # -# * `/_pat_/e`: EUC-JP +# * /_pat_/e: EUC-JP # # /foo/e.encoding # => # # -# * `/_pat_/s`: Windows-31J +# * /_pat_/s: Windows-31J # # /foo/s.encoding # => # # @@ -1195,7 +1233,7 @@ # has a *fixed* encoding. # # If a match between incompatible encodings is attempted an -# `Encoding::CompatibilityError` exception is raised. +# Encoding::CompatibilityError exception is raised. # # Example: # @@ -1262,8 +1300,9 @@ # * No backreferences. # * No subexpression calls. # * No nested lookaround anchors or atomic groups. -# * No nested quantifiers with counting (i.e. no nested `{n}`, `{min,}`, -# `{,max}`, or `{min,max}` style quantifiers) +# * No nested quantifiers with counting (i.e. no nested {n}, +# {min,}, {,max}, or {min,max} style +# quantifiers) # # You can use method Regexp.linear_time? to determine whether a pattern meets # these criteria: @@ -1357,8 +1396,8 @@ class Regexp # - Regexp.last_match(n) -> string or nil # - Regexp.last_match(name) -> string or nil # --> - # With no argument, returns the value of `$~`, which is the result of the most - # recent pattern match (see [Regexp global + # With no argument, returns the value of $~, which is the result of + # the most recent pattern match (see [Regexp global # variables](rdoc-ref:Regexp@Global+Variables)): # # /c(.)t/ =~ 'cat' # => 0 @@ -1436,14 +1475,14 @@ class Regexp # # Regexp.try_convert(/re/) # => /re/ # - # Otherwise if `object` responds to `:to_regexp`, calls `object.to_regexp` and - # returns the result. + # Otherwise if `object` responds to :to_regexp, calls + # object.to_regexp and returns the result. # - # Returns `nil` if `object` does not respond to `:to_regexp`. + # Returns `nil` if `object` does not respond to :to_regexp. # # Regexp.try_convert('re') # => nil # - # Raises an exception unless `object.to_regexp` returns a regexp. + # Raises an exception unless object.to_regexp returns a regexp. # def self.try_convert: (Regexp | _ToRegexp regexp_like) -> Regexp | (untyped other) -> Regexp? @@ -1464,7 +1503,7 @@ class Regexp # It sets the default timeout interval for Regexp matching in second. `nil` # means no default timeout configuration. This configuration is process-global. # If you want to set timeout for each Regexp, use `timeout` keyword for - # `Regexp.new`. + # Regexp.new. # # Regexp.timeout = 1 # /^a*b?a*$/ =~ "a" * 100000 + "x" #=> regexp match timeout (RuntimeError) @@ -1483,7 +1522,7 @@ class Regexp # r.match('dog') # => # # r.match('cog') # => nil # - # For each pattern that is a string, `Regexp.new(pattern)` is used: + # For each pattern that is a string, Regexp.new(pattern) is used: # # Regexp.union('penzance') # => /penzance/ # Regexp.union('a+b*c') # => /a\+b\*c/ @@ -1497,7 +1536,7 @@ class Regexp # Regexp.union([/foo/i, /bar/m, /baz/x]) # # => /(?i-mx:foo)|(?m-ix:bar)|(?x-mi:baz)/ # - # With no arguments, returns `/(?!)/`: + # With no arguments, returns /(?!)/: # # Regexp.union # => /(?!)/ # @@ -1595,7 +1634,7 @@ class Regexp # - regexp =~ string -> integer or nil # --> # Returns the integer index (in characters) of the first match for `self` and - # `string`, or `nil` if none; also sets the [rdoc-ref:Regexp global + # `string`, or `nil` if none; also sets the [Regexp global # variables](rdoc-ref:Regexp@Global+Variables): # # /at/ =~ 'input data' # => 7 @@ -1636,7 +1675,7 @@ class Regexp # ' x = y ' =~ /(?\w+)\s*=\s*(?\w+)/ # p foo, foo # Undefined local variables # - # A regexp interpolation, `#{}`, also disables the assignment: + # A regexp interpolation, #{}, also disables the assignment: # # r = /(?\w+)/ # /(?\w+)\s*=\s*#{r}/ =~ 'x = y' @@ -1926,7 +1965,7 @@ class Regexp # rdoc-file=re.c # - ~ rxp -> integer or nil # --> - # Equivalent to `rxp =~ $_`: + # Equivalent to rxp =~ $_: # # $_ = "input data" # ~ /at/ # => 7 diff --git a/core/ruby.rbs b/core/ruby.rbs index 11b6221bd..9ba006069 100644 --- a/core/ruby.rbs +++ b/core/ruby.rbs @@ -11,7 +11,7 @@ module Ruby COPYRIGHT: ::String # - # The full ruby version string, like `ruby -v` prints + # The full ruby version string, like ruby -v prints # DESCRIPTION: ::String diff --git a/core/ruby_vm.rbs b/core/ruby_vm.rbs index a990f3dbf..09cc2058c 100644 --- a/core/ruby_vm.rbs +++ b/core/ruby_vm.rbs @@ -41,8 +41,8 @@ RubyVM::OPTS: Array[String] # you want to learn how YARV works, but it also lets you control various # settings for the Ruby iseq compiler. # -# You can find the source for the VM instructions in `insns.def` in the Ruby -# source. +# You can find the source for the VM instructions in insns.def in +# the Ruby source. # # The instruction sequence results will almost certainly change as Ruby changes, # so example output in this documentation may be different from what you see. @@ -183,8 +183,8 @@ class RubyVM::InstructionSequence < Object # --> # Returns the label of this instruction sequence. # - # `
` if it's at the top level, `` if it was evaluated from a - # string. + #
if it's at the top level, if it + # was evaluated from a string. # # For example, using irb: # @@ -212,7 +212,7 @@ class RubyVM::InstructionSequence < Object # --> # Returns the path of this instruction sequence. # - # `` if the iseq was evaluated from a string. + # if the iseq was evaluated from a string. # # For example, using irb: # @@ -254,8 +254,8 @@ class RubyVM::InstructionSequence < Object # the following data: # # magic - # : A string identifying the data format. **Always - # `YARVInstructionSequence/SimpleDataFormat`.** + # : A string identifying the data format. Always + # YARVInstructionSequence/SimpleDataFormat. # # # major_version @@ -273,14 +273,14 @@ class RubyVM::InstructionSequence < Object # misc # : A hash containing: # - # `:arg_size` + # :arg_size # : the total number of arguments taken by the method or the block (0 if # *iseq* doesn't represent a method or block) # - # `:local_size` + # :local_size # : the number of local variables + 1 # - # `:stack_max` + # :stack_max # : used in calculating the stack depth at which a SystemStackError is # thrown. # @@ -290,15 +290,15 @@ class RubyVM::InstructionSequence < Object # : The name of the context (block, method, class, module, etc.) that this # instruction sequence belongs to. # - # `
` if it's at the top level, `` if it was evaluated from a - # string. + #
if it's at the top level, if + # it was evaluated from a string. # # # #path # : The relative path to the Ruby file where the instruction sequence was # loaded from. # - # `` if the iseq was evaluated from a string. + # if the iseq was evaluated from a string. # # # #absolute_path @@ -316,8 +316,9 @@ class RubyVM::InstructionSequence < Object # type # : The type of the instruction sequence. # - # Valid values are `:top`, `:method`, `:block`, `:class`, `:rescue`, - # `:ensure`, `:eval`, `:main`, and `plain`. + # Valid values are :top, :method, + # :block, :class, :rescue, + # :ensure, :eval, :main, and `plain`. # # # locals @@ -328,7 +329,7 @@ class RubyVM::InstructionSequence < Object # params # : An Hash object containing parameter information. # - # More info about these values can be found in `vm_core.h`. + # More info about these values can be found in vm_core.h. # # # catch_table @@ -400,15 +401,16 @@ module RubyVM::AbstractSyntaxTree # RubyVM::AbstractSyntaxTree.parse("x = 1 + 2") # # => # # - # If `keep_script_lines: true` option is provided, the text of the parsed source - # is associated with nodes and is available via Node#script_lines. + # If keep_script_lines: true option is provided, the text of the + # parsed source is associated with nodes and is available via Node#script_lines. # - # If `keep_tokens: true` option is provided, Node#tokens are populated. + # If keep_tokens: true option is provided, Node#tokens are + # populated. # # SyntaxError is raised if the given *string* is invalid syntax. To overwrite - # this behavior, `error_tolerant: true` can be provided. In this case, the - # parser will produce a tree where expressions with syntax errors would be - # represented by Node with `type=:ERROR`. + # this behavior, error_tolerant: true can be provided. In this + # case, the parser will produce a tree where expressions with syntax errors + # would be represented by Node with type=:ERROR. # # root = RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2") # # :33:in `parse': syntax error, unexpected ';', expecting ')' (SyntaxError) @@ -661,7 +663,7 @@ module RubyVM::YJIT # --> # Marshal dumps exit locations to the given filename. # Usage: - # If `--yjit-exit-locations` is passed, a file named + # If --yjit-exit-locations is passed, a file named # "yjit_exit_locations.dump" will automatically be generated. # If you want to collect traces manually, call `dump_exit_locations` # directly. @@ -693,11 +695,11 @@ module RubyVM::YJIT # * `stats`: # * `false`: Don't enable stats. # * `true`: Enable stats. Print stats at exit. - # * `:quiet`: Enable stats. Do not print stats at exit. + # * :quiet: Enable stats. Do not print stats at exit. # * `log`: # * `false`: Don't enable the log. # * `true`: Enable the log. Print log at exit. - # * `:quiet`: Enable the log. Do not print log at exit. + # * :quiet: Enable the log. Do not print log at exit. # def self.enable: (?stats: false | true | :quiet) -> void @@ -729,7 +731,7 @@ module RubyVM::YJIT # rdoc-file=yjit.rb # - reset_stats!() # --> - # Discard statistics collected for `--yjit-stats`. + # Discard statistics collected for --yjit-stats. # def self.reset_stats!: () -> void @@ -737,8 +739,8 @@ module RubyVM::YJIT # rdoc-file=yjit.rb # - runtime_stats(key = nil) # --> - # Return a hash for statistics generated for the `--yjit-stats` command line - # option. + # Return a hash for statistics generated for the --yjit-stats + # command line option. # Return `nil` when option is not passed or unavailable. # If a symbol argument is provided, return only the value for the named stat. # If any other type is provided, raises TypeError. @@ -749,7 +751,7 @@ module RubyVM::YJIT # rdoc-file=yjit.rb # - stats_enabled?() # --> - # Check if `--yjit-stats` is used. + # Check if --yjit-stats is used. # def self.stats_enabled?: () -> bool @@ -758,7 +760,7 @@ module RubyVM::YJIT # - stats_string() # --> # Format and print out counters as a String. This returns a non-empty - # content only when `--yjit-stats` is enabled. + # content only when --yjit-stats is enabled. # def self.stats_string: () -> String end diff --git a/core/rubygems/config_file.rbs b/core/rubygems/config_file.rbs index 09b083e66..6ee8bed52 100644 --- a/core/rubygems/config_file.rbs +++ b/core/rubygems/config_file.rbs @@ -10,20 +10,20 @@ # install: --no-rdoc --no-ri # update: --no-rdoc --no-ri # -# You can use `gem:` to set default arguments for all commands. +# You can use gem: to set default arguments for all commands. # # RubyGems options use symbol keys. Valid options are: # -# `:backtrace` +# :backtrace # : See #backtrace # -# `:sources` +# :sources # : Sets Gem::sources # -# `:verbose` +# :verbose # : See #verbose # -# `:concurrent_downloads` +# :concurrent_downloads # : See #concurrent_downloads # # diff --git a/core/rubygems/errors.rbs b/core/rubygems/errors.rbs index 50e9b93e8..d7b77c5ec 100644 --- a/core/rubygems/errors.rbs +++ b/core/rubygems/errors.rbs @@ -4,7 +4,7 @@ # # For user documentation, see: # -# * `gem help` and `gem help [command]` +# * `gem help` and gem help [command] # * [RubyGems User Guide](https://guides.rubygems.org/) # * [Frequently Asked Questions](https://guides.rubygems.org/faqs) # diff --git a/core/rubygems/requirement.rbs b/core/rubygems/requirement.rbs index e0416d0b4..8b20e1299 100644 --- a/core/rubygems/requirement.rbs +++ b/core/rubygems/requirement.rbs @@ -2,7 +2,7 @@ module Gem # # A Requirement is a set of one or more version restrictions. It supports a few - # (`=, !=, >, <, >=, <=, ~>`) different restriction operators. + # (=, !=, >, <, >=, <=, ~>) different restriction operators. # # See Gem::Version for a description on how versions and requirements work # together in RubyGems. @@ -60,11 +60,11 @@ module Gem # rdoc-file=lib/rubygems/requirement.rb # - parse(obj) # --> - # Parse `obj`, returning an `[op, version]` pair. `obj` can be a String or a - # Gem::Version. + # Parse `obj`, returning an [op, version] pair. `obj` can be a + # String or a Gem::Version. # # If `obj` is a String, it can be either a full requirement specification, like - # `">= 1.2"`, or a simple version number, like `"1.2"`. + # ">= 1.2", or a simple version number, like "1.2". # # parse("> 1.0") # => [">", Gem::Version.new("1.0")] # parse("1.0") # => ["=", Gem::Version.new("1.0")] @@ -78,7 +78,7 @@ module Gem # --> # Constructs a requirement from `requirements`. Requirements can be Strings, # Gem::Versions, or Arrays of those. `nil` and duplicate requirements are - # ignored. An empty set of `requirements` is the same as `">= 0"`. + # ignored. An empty set of `requirements` is the same as ">= 0". # def initialize: (*String | Gem::Version requirements) -> void diff --git a/core/rubygems/rubygems.rbs b/core/rubygems/rubygems.rbs index b921bc78b..2d732c1eb 100644 --- a/core/rubygems/rubygems.rbs +++ b/core/rubygems/rubygems.rbs @@ -4,7 +4,7 @@ # # For user documentation, see: # -# * `gem help` and `gem help [command]` +# * `gem help` and gem help [command] # * [RubyGems User Guide](https://guides.rubygems.org/) # * [Frequently Asked Questions](https://guides.rubygems.org/faqs) # @@ -152,7 +152,8 @@ module Gem # - activated_gem_paths() # --> # The number of paths in the +$LOAD_PATH+ from activated gems. Used to - # prioritize `-I` and `ENV['RUBYLIB']` entries during `require`. + # prioritize -I and ENV['RUBYLIB'] entries during + # `require`. # def self.activated_gem_paths: () -> Integer @@ -499,7 +500,8 @@ module Gem # rdoc-file=lib/rubygems.rb # - host() # --> - # Get the default RubyGems API host. This is normally `https://rubygems.org`. + # Get the default RubyGems API host. This is normally + # https://rubygems.org. # def self.host: () -> String diff --git a/core/set.rbs b/core/set.rbs index 33c163eff..4adcb0fa6 100644 --- a/core/set.rbs +++ b/core/set.rbs @@ -22,10 +22,11 @@ # # ## Comparison # -# The comparison operators `<`, `>`, `<=`, and `>=` are implemented as shorthand -# for the {proper_,}{subset?,superset?} methods. The `<=>` operator reflects -# this order, or returns `nil` for sets that both have distinct elements (`{x, -# y}` vs. `{x, z}` for example). +# The comparison operators <, >, <=, and +# >= are implemented as shorthand for the +# {proper_,}{subset?,superset?} methods. The <=> operator reflects +# this order, or returns `nil` for sets that both have distinct elements +# ({x, y} vs. {x, z} for example). # # ## Example # @@ -48,9 +49,9 @@ # core methods were adjusted. # # To keep backward compatibility, when a class is inherited from Set, additional -# module `Set::SubclassCompatible` is included, which makes the inherited class -# behavior, as well as internal method names, closer to what it was before Ruby -# 4.0. +# module Set::SubclassCompatible is included, which makes the +# inherited class behavior, as well as internal method names, closer to what it +# was before Ruby 4.0. # # It can be easily seen, for example, in the #inspect method behavior: # @@ -63,7 +64,7 @@ # # prints "#", like it was in Ruby 3.4 # # For new code, if backward compatibility is not necessary, it is recommended to -# instead inherit from `Set::CoreSet`, which avoids including the +# instead inherit from Set::CoreSet, which avoids including the # "compatibility" layer: # # class MyCoreSet < Set::CoreSet @@ -340,8 +341,8 @@ class Set[unchecked out A] # Set[1, 2, 3].include? 2 #=> true # Set[1, 2, 3].include? 4 #=> false # - # Note that `include?` and `member?` do not test member equality using `==` as - # do other Enumerables. + # Note that include? and member? do not test member + # equality using == as do other Enumerables. # # This is aliased to #===, so it is usable in `case` expressions: # @@ -363,8 +364,8 @@ class Set[unchecked out A] # Set[1, 2, 3].include? 2 #=> true # Set[1, 2, 3].include? 4 #=> false # - # Note that `include?` and `member?` do not test member equality using `==` as - # do other Enumerables. + # Note that include? and member? do not test member + # equality using == as do other Enumerables. # # This is aliased to #===, so it is usable in `case` expressions: # @@ -385,8 +386,8 @@ class Set[unchecked out A] # - set ^ enum -> new_set # --> # Returns a new set containing elements exclusive between the set and the given - # enumerable object. `(set ^ enum)` is equivalent to `((set | enum) - (set & - # enum))`. + # enumerable object. (set ^ enum) is equivalent to ((set | + # enum) - (set & enum)). # # Set[1, 2] ^ Set[2, 3] #=> Set[3, 1] # Set[1, 'b', 'c'] ^ ['b', 'd'] #=> Set["d", 1, "c"] @@ -500,7 +501,7 @@ class Set[unchecked out A] # - disjoint?(set) -> true or false # --> # Returns true if the set and the given enumerable have no element in common. - # This method is the opposite of `intersect?`. + # This method is the opposite of intersect?. # # Set[1, 2, 3].disjoint? Set[3, 4] #=> false # Set[1, 2, 3].disjoint? Set[4, 5] #=> true diff --git a/core/signal.rbs b/core/signal.rbs index f0a867390..fbe94caf8 100644 --- a/core/signal.rbs +++ b/core/signal.rbs @@ -26,7 +26,7 @@ # # ... # Process.kill("TERM", pid) # -# *produces:* +# produces: # Debug now: true # Debug now: false # Terminating... @@ -57,7 +57,7 @@ module Signal # Signal.trap("INT") { |signo| puts Signal.signame(signo) } # Process.kill("INT", 0) # - # *produces:* + # produces: # # INT # diff --git a/core/string.rbs b/core/string.rbs index 340d946f4..3c9e7966d 100644 --- a/core/string.rbs +++ b/core/string.rbs @@ -16,8 +16,8 @@ # * Method #String. # # Some `String` methods modify `self`. Typically, a method whose name ends with -# `!` modifies `self` and returns `self`; often, a similarly named method -# (without the `!`) returns a new string. +# ! modifies `self` and returns `self`; often, a similarly named +# method (without the !) returns a new string. # # In general, if both bang and non-bang versions of a method exist, the bang # method mutates and the non-bang method does not. However, a method without a @@ -48,7 +48,7 @@ # The examples in this section mostly use the String#sub and String#gsub # methods; the principles illustrated apply to all four substitution methods. # -# **Argument `pattern`** +# Argument `pattern` # # Argument `pattern` is commonly a regular expression: # @@ -65,7 +65,7 @@ # # 'THX1138'.gsub('\d+', '00') # => "THX1138" # -# **`String` `replacement`** +# `String` `replacement` # # If `replacement` is a string, that string determines the replacing string that # is substituted for the matched text. @@ -74,41 +74,48 @@ # # `String` `replacement` may contain back-references to the pattern's captures: # -# * `\n` (*n* is a non-negative integer) refers to `$n`. -# * `\k` refers to the named capture `name`. +# * \n (*n* is a non-negative integer) refers to $n. +# * \k refers to the named capture `name`. # # See Regexp for details. # # Note that within the string `replacement`, a character combination such as -# `$&` is treated as ordinary text, not as a special match variable. However, -# you may refer to some special match variables using these combinations: -# -# * `\&` and `\0` correspond to `$&`, which contains the complete matched -# text. -# * `\'` corresponds to `$'`, which contains the string after the match. -# * ``` corresponds to `$``, which contains the string before the match. -# * `\+` corresponds to `$+`, which contains the last capture group. +# $& is treated as ordinary text, not as a special match variable. +# However, you may refer to some special match variables using these +# combinations: +# +# * \& and \0 correspond to $&, which +# contains the complete matched text. +# * \' corresponds to $', which contains the string +# after the match. +# * ` corresponds to $`, which contains the string +# before the match. +# * \+ corresponds to $+, which contains the last +# capture group. # # See Regexp for details. # -# Note that `\\\` is interpreted as an escape, i.e., a single backslash. +# Note that \\ is interpreted as an escape, i.e., a single +# backslash. # # Note also that a string literal consumes backslashes. See [String # Literals](rdoc-ref:syntax/literals.rdoc@String+Literals) for details about # string literals. # # A back-reference is typically preceded by an additional backslash. For -# example, if you want to write a back-reference `\&` in `replacement` with a -# double-quoted string literal, you need to write `"..\\\\&.."`. +# example, if you want to write a back-reference \& in +# `replacement` with a double-quoted string literal, you need to write +# "..\\&..". # -# If you want to write a non-back-reference string `\&` in `replacement`, you -# need to first escape the backslash to prevent this method from interpreting it -# as a back-reference, and then you need to escape the backslashes again to -# prevent a string literal from consuming them: `"..\\\\\\\\&.."`. +# If you want to write a non-back-reference string \& in +# `replacement`, you need to first escape the backslash to prevent this method +# from interpreting it as a back-reference, and then you need to escape the +# backslashes again to prevent a string literal from consuming them: +# "..\\\\&..". # # You may want to use the block form to avoid excessive backslashes. # -# **\Hash `replacement`** +# Hash `replacement` # # If the argument `replacement` is a hash, and `pattern` matches one of its # keys, the replacing string is the value for that key: @@ -129,21 +136,21 @@ # s = '@' # '1234'.gsub(/\d/) { |match| s.succ! } # => "ABCD" # -# Special match variables such as `$1`, `$2`, `$``, `$&`, and `$'` are set -# appropriately. +# Special match variables such as $1, $2, +# $`, $&, and $' are set appropriately. # # ## Whitespace in Strings # # In the class `String`, *whitespace* is defined as a contiguous sequence of # characters consisting of any mixture of the following: # -# * NL (null): `"\x00"`, `"\u0000"`. -# * HT (horizontal tab): `"\x09"`, `"\t"`. -# * LF (line feed): `"\x0a"`, `"\n"`. -# * VT (vertical tab): `"\x0b"`, `"\v"`. -# * FF (form feed): `"\x0c"`, `"\f"`. -# * CR (carriage return): `"\x0d"`, `"\r"`. -# * SP (space): `"\x20"`, `" "`. +# * NL (null): "\x00", "\u0000". +# * HT (horizontal tab): "\x09", "\t". +# * LF (line feed): "\x0a", "\n". +# * VT (vertical tab): "\x0b", "\v". +# * FF (form feed): "\x0c", "\f". +# * CR (carriage return): "\x0d", "\r". +# * SP (space): "\x20", " ". # # Whitespace is relevant for the following methods: # @@ -160,15 +167,14 @@ # # Here, class `String` provides methods that are useful for: # -# * [Creating a \String](rdoc-ref:String@Creating+a+String). -# * [Freezing/Unfreezing a \String](rdoc-ref:String@Freezing-2FUnfreezing). -# * [Querying a \String](rdoc-ref:String@Querying). +# * [Creating a String](rdoc-ref:String@Creating+a+String). +# * [Freezing/Unfreezing a String](rdoc-ref:String@Freezing-2FUnfreezing). +# * [Querying a String](rdoc-ref:String@Querying). # * [Comparing Strings](rdoc-ref:String@Comparing). -# * [Modifying a \String](rdoc-ref:String@Modifying). -# * [Converting to a new \String](rdoc-ref:String@Converting+to+New+String). -# * [Converting to a -# non-\String](rdoc-ref:String@Converting+to+Non--5CString). -# * [Iterating over a \String](rdoc-ref:String@Iterating). +# * [Modifying a String](rdoc-ref:String@Modifying). +# * [Converting to a new String](rdoc-ref:String@Converting+to+New+String). +# * [Converting to a non-String](rdoc-ref:String@Converting+to+Non--5CString). +# * [Iterating over a String](rdoc-ref:String@Iterating). # # ### Creating a String # @@ -177,10 +183,10 @@ # # ### Freezing/Unfreezing # -# * #+@: Returns a string that is not frozen: `self` if not frozen; `self.dup` -# otherwise. +# * #+@: Returns a string that is not frozen: `self` if not frozen; +# self.dup otherwise. # * #-@ (aliased as #dedup): Returns a string that is frozen: `self` if -# already frozen; `self.freeze` otherwise. +# already frozen; self.freeze otherwise. # * #freeze: Freezes `self` if not already frozen; returns `self`. # # ### Querying @@ -406,7 +412,7 @@ # # Each of these methods converts the contents of `self` to a non-`String`. # -# *Characters, Bytes, and Clusters* +# Characters, Bytes, and Clusters # # * #bytes: Returns an array of the bytes in `self`. # * #chars: Returns an array of the characters in `self`. @@ -489,8 +495,8 @@ # * Method #String. # # Some `String` methods modify `self`. Typically, a method whose name ends with -# `!` modifies `self` and returns `self`; often, a similarly named method -# (without the `!`) returns a new string. +# ! modifies `self` and returns `self`; often, a similarly named +# method (without the !) returns a new string. # # In general, if both bang and non-bang versions of a method exist, the bang # method mutates and the non-bang method does not. However, a method without a @@ -521,7 +527,7 @@ # The examples in this section mostly use the String#sub and String#gsub # methods; the principles illustrated apply to all four substitution methods. # -# **Argument `pattern`** +# Argument `pattern` # # Argument `pattern` is commonly a regular expression: # @@ -538,7 +544,7 @@ # # 'THX1138'.gsub('\d+', '00') # => "THX1138" # -# **`String` `replacement`** +# `String` `replacement` # # If `replacement` is a string, that string determines the replacing string that # is substituted for the matched text. @@ -547,41 +553,48 @@ # # `String` `replacement` may contain back-references to the pattern's captures: # -# * `\n` (*n* is a non-negative integer) refers to `$n`. -# * `\k` refers to the named capture `name`. +# * \n (*n* is a non-negative integer) refers to $n. +# * \k refers to the named capture `name`. # # See Regexp for details. # # Note that within the string `replacement`, a character combination such as -# `$&` is treated as ordinary text, not as a special match variable. However, -# you may refer to some special match variables using these combinations: -# -# * `\&` and `\0` correspond to `$&`, which contains the complete matched -# text. -# * `\'` corresponds to `$'`, which contains the string after the match. -# * ``` corresponds to `$``, which contains the string before the match. -# * `\+` corresponds to `$+`, which contains the last capture group. +# $& is treated as ordinary text, not as a special match variable. +# However, you may refer to some special match variables using these +# combinations: +# +# * \& and \0 correspond to $&, which +# contains the complete matched text. +# * \' corresponds to $', which contains the string +# after the match. +# * ` corresponds to $`, which contains the string +# before the match. +# * \+ corresponds to $+, which contains the last +# capture group. # # See Regexp for details. # -# Note that `\\\` is interpreted as an escape, i.e., a single backslash. +# Note that \\ is interpreted as an escape, i.e., a single +# backslash. # # Note also that a string literal consumes backslashes. See [String # Literals](rdoc-ref:syntax/literals.rdoc@String+Literals) for details about # string literals. # # A back-reference is typically preceded by an additional backslash. For -# example, if you want to write a back-reference `\&` in `replacement` with a -# double-quoted string literal, you need to write `"..\\\\&.."`. +# example, if you want to write a back-reference \& in +# `replacement` with a double-quoted string literal, you need to write +# "..\\&..". # -# If you want to write a non-back-reference string `\&` in `replacement`, you -# need to first escape the backslash to prevent this method from interpreting it -# as a back-reference, and then you need to escape the backslashes again to -# prevent a string literal from consuming them: `"..\\\\\\\\&.."`. +# If you want to write a non-back-reference string \& in +# `replacement`, you need to first escape the backslash to prevent this method +# from interpreting it as a back-reference, and then you need to escape the +# backslashes again to prevent a string literal from consuming them: +# "..\\\\&..". # # You may want to use the block form to avoid excessive backslashes. # -# **\Hash `replacement`** +# Hash `replacement` # # If the argument `replacement` is a hash, and `pattern` matches one of its # keys, the replacing string is the value for that key: @@ -602,21 +615,21 @@ # s = '@' # '1234'.gsub(/\d/) { |match| s.succ! } # => "ABCD" # -# Special match variables such as `$1`, `$2`, `$``, `$&`, and `$'` are set -# appropriately. +# Special match variables such as $1, $2, +# $`, $&, and $' are set appropriately. # # ## Whitespace in Strings # # In the class `String`, *whitespace* is defined as a contiguous sequence of # characters consisting of any mixture of the following: # -# * NL (null): `"\x00"`, `"\u0000"`. -# * HT (horizontal tab): `"\x09"`, `"\t"`. -# * LF (line feed): `"\x0a"`, `"\n"`. -# * VT (vertical tab): `"\x0b"`, `"\v"`. -# * FF (form feed): `"\x0c"`, `"\f"`. -# * CR (carriage return): `"\x0d"`, `"\r"`. -# * SP (space): `"\x20"`, `" "`. +# * NL (null): "\x00", "\u0000". +# * HT (horizontal tab): "\x09", "\t". +# * LF (line feed): "\x0a", "\n". +# * VT (vertical tab): "\x0b", "\v". +# * FF (form feed): "\x0c", "\f". +# * CR (carriage return): "\x0d", "\r". +# * SP (space): "\x20", " ". # # Whitespace is relevant for the following methods: # @@ -633,15 +646,14 @@ # # Here, class `String` provides methods that are useful for: # -# * [Creating a \String](rdoc-ref:String@Creating+a+String). -# * [Freezing/Unfreezing a \String](rdoc-ref:String@Freezing-2FUnfreezing). -# * [Querying a \String](rdoc-ref:String@Querying). +# * [Creating a String](rdoc-ref:String@Creating+a+String). +# * [Freezing/Unfreezing a String](rdoc-ref:String@Freezing-2FUnfreezing). +# * [Querying a String](rdoc-ref:String@Querying). # * [Comparing Strings](rdoc-ref:String@Comparing). -# * [Modifying a \String](rdoc-ref:String@Modifying). -# * [Converting to a new \String](rdoc-ref:String@Converting+to+New+String). -# * [Converting to a -# non-\String](rdoc-ref:String@Converting+to+Non--5CString). -# * [Iterating over a \String](rdoc-ref:String@Iterating). +# * [Modifying a String](rdoc-ref:String@Modifying). +# * [Converting to a new String](rdoc-ref:String@Converting+to+New+String). +# * [Converting to a non-String](rdoc-ref:String@Converting+to+Non--5CString). +# * [Iterating over a String](rdoc-ref:String@Iterating). # # ### Creating a String # @@ -650,10 +662,10 @@ # # ### Freezing/Unfreezing # -# * #+@: Returns a string that is not frozen: `self` if not frozen; `self.dup` -# otherwise. +# * #+@: Returns a string that is not frozen: `self` if not frozen; +# self.dup otherwise. # * #-@ (aliased as #dedup): Returns a string that is frozen: `self` if -# already frozen; `self.freeze` otherwise. +# already frozen; self.freeze otherwise. # * #freeze: Freezes `self` if not already frozen; returns `self`. # # ### Querying @@ -879,7 +891,7 @@ # # Each of these methods converts the contents of `self` to a non-`String`. # -# *Characters, Bytes, and Clusters* +# Characters, Bytes, and Clusters # # * #bytes: Returns an array of the bytes in `self`. # * #chars: Returns an array of the characters in `self`. @@ -958,12 +970,12 @@ class String # # If `object` is already a string, returns `object`, unmodified. # - # Otherwise if `object` responds to `:to_str`, calls `object.to_str` and returns - # the result. + # Otherwise if `object` responds to :to_str, calls + # object.to_str and returns the result. # - # Returns `nil` if `object` does not respond to `:to_str`. + # Returns `nil` if `object` does not respond to :to_str. # - # Raises an exception unless `object.to_str` returns a string. + # Raises an exception unless object.to_str returns a string. # def self.try_convert: (String object) -> String # technically will return `object` unchanged. | (_ToStr object) -> String @@ -978,7 +990,7 @@ class String # The `options` are optional keyword options (see below). # # With no argument given and keyword `encoding` also not given, returns an empty - # string with the Encoding `ASCII-8BIT`: + # string with the Encoding ASCII-8BIT: # # s = String.new # => "" # s.encoding # => # @@ -991,9 +1003,10 @@ class String # s1.encoding # => # # # (Unlike String.new, a [string - # literal](rdoc-ref:syntax/literals.rdoc@String+Literals) like `''` or a [here - # document literal](rdoc-ref:syntax/literals.rdoc@Here+Document+Literals) always - # has [script encoding](rdoc-ref:encodings.rdoc@Script+Encoding).) + # literal](rdoc-ref:syntax/literals.rdoc@String+Literals) like '' + # or a [here document + # literal](rdoc-ref:syntax/literals.rdoc@Here+Document+Literals) always has + # [script encoding](rdoc-ref:encodings.rdoc@Script+Encoding).) # # With keyword option `encoding` given, returns a string with the specified # encoding; the `encoding` may be an Encoding object, an encoding name, or an @@ -1094,7 +1107,7 @@ class String # Returns `self` if `self` is not frozen and can be mutated without warning # issuance. # - # Otherwise returns `self.dup`, which is not frozen. + # Otherwise returns self.dup, which is not frozen. # # Related: see [Freezing/Unfreezing](rdoc-ref:String@Freezing-2FUnfreezing). # @@ -1154,8 +1167,9 @@ class String # s = 'foo' # s << 33 # => "foo!" # - # Additionally, if the codepoint is in range `0..0xff` and the encoding of - # `self` is Encoding::US_ASCII, changes the encoding to Encoding::ASCII_8BIT: + # Additionally, if the codepoint is in range 0..0xff and the + # encoding of `self` is Encoding::US_ASCII, changes the encoding to + # Encoding::ASCII_8BIT: # # s = 'foo'.encode(Encoding::US_ASCII) # s.encoding # => # @@ -1183,7 +1197,7 @@ class String # # Returns: # - # * `-1`, if `self` is smaller. + # * -1, if `self` is smaller. # * `0`, if the two are equal. # * `1`, if `self` is larger. # * `nil`, if the two are incomparable. @@ -1225,8 +1239,8 @@ class String # # When `object` is not a string: # - # * If `object` responds to method `to_str`, `object == self` is called and - # its return value is returned. + # * If `object` responds to method `to_str`, object == self is + # called and its return value is returned. # * If `object` does not respond to `to_str`, `false` is returned. # # Related: [Comparing](rdoc-ref:String@Comparing). @@ -1250,8 +1264,8 @@ class String # # When `object` is not a string: # - # * If `object` responds to method `to_str`, `object == self` is called and - # its return value is returned. + # * If `object` responds to method `to_str`, object == self is + # called and its return value is returned. # * If `object` does not respond to `to_str`, `false` is returned. # # Related: [Comparing](rdoc-ref:String@Comparing). @@ -1273,8 +1287,8 @@ class String # 'foo' =~ /x/ # => nil # $~ # => nil # - # Note that `string =~ regexp` is different from `regexp =~ string` (see - # Regexp#=~): + # Note that string =~ regexp is different from regexp =~ + # string (see Regexp#=~): # # number = nil # 'no. 9' =~ /(?\d+)/ # => 4 @@ -1282,7 +1296,8 @@ class String # /(?\d+)/ =~ 'no. 9' # => 4 # number # => "9" # Assigned. # - # If `object` is not a Regexp, returns the value returned by `object =~ self`. + # If `object` is not a Regexp, returns the value returned by object =~ + # self. # # Related: see [Querying](rdoc-ref:String@Querying). # @@ -1303,7 +1318,7 @@ class String # --> # Returns the substring of `self` specified by the arguments. # - # **Form `self[index]`** + # Form self[index] # # With non-negative integer argument `index` given, returns the 1-character # substring found in self at character offset index: @@ -1321,7 +1336,7 @@ class String # 'hello'[-5] # => "h" # 'hello'[-6] # => nil # - # **Form `self[start, length]`** + # Form self[start, length] # # With integer arguments `start` and `length` given, returns a substring of size # `length` characters (as available) beginning at character offset specified by @@ -1348,10 +1363,10 @@ class String # # 'hello'[5, 3] # => "" # - # **Form `self[range]`** + # Form self[range] # - # With Range argument `range` given, forms substring `self[range.start, - # range.size]`: + # With Range argument `range` given, forms substring self[range.start, + # range.size]: # # 'hello'[0..2] # => "hel" # 'hello'[0, 3] # => "hel" @@ -1362,7 +1377,7 @@ class String # 'hello'[0, 0] # => "" # 'hello'[0...0] # => "" # - # **Form `self[regexp, capture = 0]`** + # Form self[regexp, capture = 0] # # With Regexp argument `regexp` given and `capture` as zero, searches for a # matching substring in `self`; updates [Regexp-related global @@ -1384,7 +1399,7 @@ class String # 'hello'[/(h)(e)(l+)(o)/, 4] # => "o" # 'hello'[/(h)(e)(l+)(o)/, 5] # => nil # - # **Form `self[substring]`** + # Form self[substring] # # With string argument `substring` given, returns the matching substring of # `self`, if found: @@ -1414,7 +1429,7 @@ class String # Returns `self` with all, a substring, or none of its contents replaced; # returns the argument `other_string`. # - # **Form `self[index] = other_string`** + # Form self[index] = other_string # # With non-negative integer argument `index` given, searches for the 1-character # substring found in self at character offset index: @@ -1448,7 +1463,7 @@ class String # s = 'hello' # s[-6] = 'foo' # Raises IndexError: index -6 out of string. # - # **Form `self[start, length] = other_string`** + # Form self[start, length] = other_string # # With integer arguments `start` and `length` given, searches for a substring of # size `length` characters (as available) beginning at character offset @@ -1503,10 +1518,10 @@ class String # s[5, 3] = 'foo' # => "foo" # s # => "hellofoo" # - # **Form `self[range] = other_string`** + # Form self[range] = other_string # - # With Range argument `range` given, equivalent to `self[range.start, - # range.size] = other_string`: + # With Range argument `range` given, equivalent to self[range.start, + # range.size] = other_string: # # s0 = 'hello' # s1 = 'hello' @@ -1526,7 +1541,7 @@ class String # s = 'hello' # s[9..10] = 'foo' # Raises RangeError: 9..10 out of range # - # **Form `self[regexp, capture = 0] = other_string`** + # Form self[regexp, capture = 0] = other_string # # With Regexp argument `regexp` given and `capture` as zero, searches for a # matching substring in `self`; updates [Regexp-related global @@ -1569,7 +1584,7 @@ class String # s = 'hello' # s[/nosuch/] = 'foo' # Raises IndexError: regexp not matched. # - # **Form `self[substring] = other_string`** + # Form self[substring] = other_string # # With string argument `substring` given: # @@ -1884,8 +1899,8 @@ class String # s.byteslice(-4) # => "6" # s.byteslice(-4, 3) # => "678" # - # With Range argument `range` given, returns `byteslice(range.begin, - # range.size)`: + # With Range argument `range` given, returns byteslice(range.begin, + # range.size): # # s = '0123456789' # => "0123456789" # s.byteslice(4..6) # => "456" @@ -2019,8 +2034,9 @@ class String # s = 'こんにちは' # s.capitalize == s # => true # - # The casing is affected by the given `mapping`, which may be `:ascii`, `:fold`, - # or `:turkic`; see [Case Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). + # The casing is affected by the given `mapping`, which may be + # :ascii, :fold, or :turkic; see [Case + # Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). # # Related: see [Converting to New # String](rdoc-ref:String@Converting+to+New+String). @@ -2052,9 +2068,11 @@ class String # --> # Ignoring case, compares `self` and `other_string`; returns: # - # * -1 if `self.downcase` is smaller than `other_string.downcase`. + # * -1 if self.downcase is smaller than + # other_string.downcase. # * 0 if the two are equal. - # * 1 if `self.downcase` is larger than `other_string.downcase`. + # * 1 if self.downcase is larger than + # other_string.downcase. # * `nil` if the two are incomparable. # # See [Case Mapping](rdoc-ref:case_mapping.rdoc). @@ -2151,8 +2169,9 @@ class String # Returns a new string copied from `self`, with trailing characters possibly # removed: # - # When `line_sep` is `"\n"`, removes the last one or two characters if they are - # `"\r"`, `"\n"`, or `"\r\n"` (but not `"\n\r"`): + # When `line_sep` is "\n", removes the last one or two characters + # if they are "\r", "\n", or "\r\n" (but + # not "\n\r"): # # $/ # => "\n" # "abc\r".chomp # => "abc" @@ -2162,8 +2181,9 @@ class String # "тест\r\n".chomp # => "тест" # "こんにちは\r\n".chomp # => "こんにちは" # - # When `line_sep` is `''` (an empty string), removes multiple trailing - # occurrences of `"\n"` or `"\r\n"` (but not `"\r"` or `"\n\r"`): + # When `line_sep` is '' (an empty string), removes multiple + # trailing occurrences of "\n" or "\r\n" (but not + # "\r" or "\n\r"): # # "abc\n\n\n".chomp('') # => "abc" # "abc\r\n\r\n\r\n".chomp('') # => "abc" @@ -2171,8 +2191,8 @@ class String # "abc\n\r\n\r\n\r".chomp('') # => "abc\n\r\n\r\n\r" # "abc\r\r\r".chomp('') # => "abc\r\r\r" # - # When `line_sep` is neither `"\n"` nor `''`, removes a single trailing line - # separator if there is one: + # When `line_sep` is neither "\n" nor '', removes a + # single trailing line separator if there is one: # # 'abcd'.chomp('cd') # => "ab" # 'abcdcd'.chomp('cd') # => "abcd" @@ -2205,7 +2225,7 @@ class String # Returns a new string copied from `self`, with trailing characters possibly # removed. # - # Removes `"\r\n"` if those are the last two characters. + # Removes "\r\n" if those are the last two characters. # # "abc\r\n".chop # => "abc" # "тест\r\n".chop # => "тест" @@ -2356,20 +2376,20 @@ class String # # In a character selector, three characters get special treatment: # - # * A caret (`'^'`) functions as a *negation* operator for the immediately - # following characters: + # * A caret ('^') functions as a *negation* operator for the + # immediately following characters: # # s = 'abracadabra' # s.count('^bc') # => 8 # Count of all except 'b' and 'c'. # - # * A hyphen (`'-'`) between two other characters defines a *range* of - # characters: + # * A hyphen ('-') between two other characters defines a *range* + # of characters: # # s = 'abracadabra' # s.count('a-c') # => 8 # Count of all 'a', 'b', and 'c'. # - # * A backslash (`'\'`) acts as an escape for a caret, a hyphen, or another - # backslash: + # * A backslash ('\') acts as an escape for a caret, a hyphen, or + # another backslash: # # s = 'abracadabra' # s.count('\^bc') # => 3 # Count of '^', 'b', and 'c'. @@ -2399,24 +2419,24 @@ class String # rdoc-file=string.c # - crypt(salt_str) -> new_string # --> - # Returns the string generated by calling `crypt(3)` standard library function - # with `str` and `salt_str`, in this order, as its arguments. Please do not use - # this method any longer. It is legacy; provided only for backward + # Returns the string generated by calling crypt(3) standard library + # function with `str` and `salt_str`, in this order, as its arguments. Please + # do not use this method any longer. It is legacy; provided only for backward # compatibility with ruby scripts in earlier days. It is bad to use in # contemporary programs for several reasons: # - # * Behaviour of C's `crypt(3)` depends on the OS it is run. The generated - # string lacks data portability. + # * Behaviour of C's crypt(3) depends on the OS it is run. The + # generated string lacks data portability. # - # * On some OSes such as Mac OS, `crypt(3)` never fails (i.e. silently ends up - # in unexpected results). + # * On some OSes such as Mac OS, crypt(3) never fails (i.e. + # silently ends up in unexpected results). # - # * On some OSes such as Mac OS, `crypt(3)` is not thread safe. + # * On some OSes such as Mac OS, crypt(3) is not thread safe. # - # * So-called "traditional" usage of `crypt(3)` is very very very weak. - # According to its manpage, Linux's traditional `crypt(3)` output has only - # 2**56 variations; too easy to brute force today. And this is the default - # behaviour. + # * So-called "traditional" usage of crypt(3) is very very very + # weak. According to its manpage, Linux's traditional crypt(3) + # output has only 2**56 variations; too easy to brute force today. And this + # is the default behaviour. # # * In order to make things robust some OSes implement so-called "modular" # usage. To go through, you have to do a complex build-up of the `salt_str` @@ -2431,21 +2451,22 @@ class String # "foo".crypt("$5$round=1000$salt$") # Typo not detected # # * Even in the "modular" mode, some hash functions are considered archaic and - # no longer recommended at all; for instance module `$1$` is officially - # abandoned by its author: see http://phk.freebsd.dk/sagas/md5crypt_eol/ . - # For another instance module `$3$` is considered completely broken: see the - # manpage of FreeBSD. + # no longer recommended at all; for instance module $1$ is + # officially abandoned by its author: see + # http://phk.freebsd.dk/sagas/md5crypt_eol/ . For another instance module + # $3$ is considered completely broken: see the manpage of + # FreeBSD. # # * On some OS such as Mac OS, there is no modular mode. Yet, as written - # above, `crypt(3)` on Mac OS never fails. This means even if you build up a - # proper salt string it generates a traditional DES hash anyways, and there - # is no way for you to be aware of. + # above, crypt(3) on Mac OS never fails. This means even if you + # build up a proper salt string it generates a traditional DES hash anyways, + # and there is no way for you to be aware of. # # "foo".crypt("$5$rounds=1000$salt$") # => "$5fNPQMxC5j6." # # If for some reason you cannot migrate to other secure contemporary password - # hashing algorithms, install the string-crypt gem and `require 'string/crypt'` - # to continue using it. + # hashing algorithms, install the string-crypt gem and require + # 'string/crypt' to continue using it. # %a{deprecated} def crypt: (string salt_str) -> String @@ -2532,20 +2553,20 @@ class String # # In a character selector, three characters get special treatment: # - # * A caret (`'^'`) functions as a *negation* operator for the immediately - # following characters: + # * A caret ('^') functions as a *negation* operator for the + # immediately following characters: # # s = 'abracadabra' # s.delete('^bc') # => "bcb" # Deletes all except 'b' and 'c'. # - # * A hyphen (`'-'`) between two other characters defines a *range* of - # characters: + # * A hyphen ('-') between two other characters defines a *range* + # of characters: # # s = 'abracadabra' # s.delete('a-c') # => "rdr" # Deletes all 'a', 'b', and 'c'. # - # * A backslash (`'\'`) acts as an escape for a caret, a hyphen, or another - # backslash: + # * A backslash ('\') acts as an escape for a caret, a hyphen, or + # another backslash: # # s = 'abracadabra' # s.delete('\^bc') # => "araadara" # Deletes all '^', 'b', and 'c'. @@ -2661,8 +2682,9 @@ class String # s = 'こんにちは' # s.downcase == s # => true # - # The casing is affected by the given `mapping`, which may be `:ascii`, `:fold`, - # or `:turkic`; see [Case Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). + # The casing is affected by the given `mapping`, which may be + # :ascii, :fold, or :turkic; see [Case + # Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). # # Related: see [Converting to New # String](rdoc-ref:String@Converting+to+New+String). @@ -2723,7 +2745,7 @@ class String # print "Undumped: ", s.dump.undump, "\n" # end # - # So that for string `'hello'`, we'll see: + # So that for string 'hello', we'll see: # # String: hello # Dumped: "hello" @@ -2774,10 +2796,11 @@ class String # Undumped: こんにちは # # If the encoding of `self` is not ASCII-compatible (i.e., if - # `self.encoding.ascii_compatible?` returns `false`), each ASCII-compatible byte - # is dumped as an ASCII character, and all other bytes are dumped as - # hexadecimal; also appends `.dup.force_encoding(\"encoding\")`, where - # `` is `self.encoding.name`: + # self.encoding.ascii_compatible? returns `false`), each + # ASCII-compatible byte is dumped as an ASCII character, and all other bytes are + # dumped as hexadecimal; also appends + # .dup.force_encoding(\"encoding\"), where + # is self.encoding.name: # # String: hello # Dumped: "\xFE\xFF\x00h\x00e\x00l\x00l\x00o".dup.force_encoding("UTF-16") @@ -3017,8 +3040,8 @@ class String # # With no arguments: # - # * Uses the same encoding if `Encoding.default_internal` is `nil` (the - # default): + # * Uses the same encoding if Encoding.default_internal is `nil` + # (the default): # # Encoding.default_internal # => nil # s = "Ruby\x99".force_encoding('Windows-1252') @@ -3028,7 +3051,7 @@ class String # t.encoding # => # # t.bytes # => [82, 117, 98, 121, 226, 132, 162] # - # * Otherwise, uses the encoding `Encoding.default_internal`: + # * Otherwise, uses the encoding Encoding.default_internal: # # Encoding.default_internal = 'UTF-8' # t = s.encode # => "Ruby™" @@ -3051,11 +3074,11 @@ class String # Optional keyword arguments `enc_opts` specify encoding options; see [Encoding # Options](rdoc-ref:encodings.rdoc@Encoding+Options). # - # Please note that, unless `invalid: :replace` option is given, conversion from - # an encoding `enc` to the same encoding `enc` (independent of whether `enc` is - # given explicitly or implicitly) is a no-op, i.e. the string is simply copied - # without any changes, and no exceptions are raised, even if there are invalid - # bytes. + # Please note that, unless invalid: :replace option is given, + # conversion from an encoding `enc` to the same encoding `enc` (independent of + # whether `enc` is given explicitly or implicitly) is a no-op, i.e. the string + # is simply copied without any changes, and no exceptions are raised, even if + # there are invalid bytes. # # Related: see [Converting to New # String](rdoc-ref:String@Converting+to+New+String). @@ -3351,9 +3374,9 @@ class String # The leading substring is interpreted as hexadecimal when it begins with: # # * One or more character representing hexadecimal digits (each in one of the - # ranges `'0'..'9'`, `'a'..'f'`, or `'A'..'F'`); the string to be - # interpreted ends at the first character that does not represent a - # hexadecimal digit: + # ranges '0'..'9', 'a'..'f', or + # 'A'..'F'); the string to be interpreted ends at the first + # character that does not represent a hexadecimal digit: # # 'f'.hex # => 15 # '11'.hex # => 17 @@ -3363,12 +3386,14 @@ class String # 'bar'.hex # => 186 # 'ba' hexadecimal, 'r' not. # 'deadbeef'.hex # => 3735928559 # - # * `'0x'` or `'0X'`, followed by one or more hexadecimal digits: + # * '0x' or '0X', followed by one or more + # hexadecimal digits: # # '0xfff'.hex # => 4095 # '0xfffg'.hex # => 4095 # - # Any of the above may prefixed with `'-'`, which negates the interpreted value: + # Any of the above may prefixed with '-', which negates the + # interpreted value: # # '-fff'.hex # => -4095 # '-0xFFF'.hex # => -4095 @@ -3496,15 +3521,15 @@ class String # 'тест'.inspect # => "\"тест\"" # 'こんにちは'.inspect # => "\"こんにちは\"" # - # But printable characters double-quote (`'"'`) and backslash and (`'\\'`) are - # escaped: + # But printable characters double-quote ('"') and backslash and + # ('\') are escaped: # # '"'.inspect # => "\"\\\"\"" # '\\'.inspect # => "\"\\\\\"" # # Unprintable characters are the [ASCII # characters](https://en.wikipedia.org/wiki/ASCII) whose values are in range - # `0..31`, along with the character whose value is `127`. + # 0..31, along with the character whose value is `127`. # # Most of these characters are rendered thus: # @@ -3631,7 +3656,7 @@ class String # 'тест'.ljust(10) # => "тест " # 'こんにちは'.ljust(10) # => "こんにちは " # - # If `width <= self.length`, returns a copy of `self`: + # If width <= self.length, returns a copy of `self`: # # 'hello'.ljust(5) # => "hello" # 'hello'.ljust(1) # => "hello" # Does not truncate to width. @@ -3735,8 +3760,8 @@ class String # # regexp = Regexp.new(pattern) # - # Returns `true` if `self[offset..].match(regexp)` returns a MatchData object, - # `false` otherwise: + # Returns `true` if self[offset..].match(regexp) returns a + # MatchData object, `false` otherwise: # # 'foo'.match?(/o/) # => true # 'foo'.match?('o') # => true @@ -3835,8 +3860,8 @@ class String # The leading substring is interpreted as octal when it begins with: # # * One or more character representing octal digits (each in the range - # `'0'..'7'`); the string to be interpreted ends at the first character that - # does not represent an octal digit: + # '0'..'7'); the string to be interpreted ends at the first + # character that does not represent an octal digit: # # '7'.oct @ => 7 # '11'.oct # => 9 @@ -3845,39 +3870,41 @@ class String # '7778'.oct # => 511 # '777x'.oct # => 511 # - # * `'0o'`, followed by one or more octal digits: + # * '0o', followed by one or more octal digits: # # '0o777'.oct # => 511 # '0o7778'.oct # => 511 # # The leading substring is *not* interpreted as octal when it begins with: # - # * `'0b'`, followed by one or more characters representing binary digits - # (each in the range `'0'..'1'`); the string to be interpreted ends at the - # first character that does not represent a binary digit. the string is - # interpreted as binary digits (base 2): + # * '0b', followed by one or more characters representing binary + # digits (each in the range '0'..'1'); the string to be + # interpreted ends at the first character that does not represent a binary + # digit. the string is interpreted as binary digits (base 2): # # '0b111'.oct # => 7 # '0b1112'.oct # => 7 # - # * `'0d'`, followed by one or more characters representing decimal digits - # (each in the range `'0'..'9'`); the string to be interpreted ends at the - # first character that does not represent a decimal digit. the string is - # interpreted as decimal digits (base 10): + # * '0d', followed by one or more characters representing decimal + # digits (each in the range '0'..'9'); the string to be + # interpreted ends at the first character that does not represent a decimal + # digit. the string is interpreted as decimal digits (base 10): # # '0d999'.oct # => 999 # '0d999x'.oct # => 999 # - # * `'0x'`, followed by one or more characters representing hexadecimal digits - # (each in one of the ranges `'0'..'9'`, `'a'..'f'`, or `'A'..'F'`); the - # string to be interpreted ends at the first character that does not - # represent a hexadecimal digit. the string is interpreted as hexadecimal - # digits (base 16): + # * '0x', followed by one or more characters representing + # hexadecimal digits (each in one of the ranges '0'..'9', + # 'a'..'f', or 'A'..'F'); the string to be + # interpreted ends at the first character that does not represent a + # hexadecimal digit. the string is interpreted as hexadecimal digits (base + # 16): # # '0xfff'.oct # => 4095 # '0xfffg'.oct # => 4095 # - # Any of the above may prefixed with `'-'`, which negates the interpreted value: + # Any of the above may prefixed with '-', which negates the + # interpreted value: # # '-777'.oct # => -511 # '-0777'.oct # => -511 @@ -3929,11 +3956,11 @@ class String # # [self.dup, "", ""] # - # Note that in the examples below, a returned string `'hello'` is a copy of - # `self`, not `self`. + # Note that in the examples below, a returned string 'hello' is a + # copy of `self`, not `self`. # - # If `pattern` is a Regexp, performs the equivalent of `self.match(pattern)` - # (also setting [matched-data + # If `pattern` is a Regexp, performs the equivalent of + # self.match(pattern) (also setting [matched-data # variables](rdoc-ref:language/globals.md@Matched+Data)): # # 'hello'.partition(/h/) # => ["", "h", "ello"] @@ -3946,8 +3973,8 @@ class String # 'hello'.partition(/x/) # => ["hello", "", ""] # # If `pattern` is not a Regexp, converts it to a string (if it is not already - # one), then performs the equivalent of `self.index(pattern)` (and does *not* - # set [matched-data global + # one), then performs the equivalent of self.index(pattern) (and + # does *not* set [matched-data global # variables](rdoc-ref:language/globals.md@Matched+Data)): # # 'hello'.partition('h') # => ["", "h", "ello"] @@ -4098,7 +4125,7 @@ class String # 'тест'.rjust(10) # => " тест" # 'こんにちは'.rjust(10) # => " こんにちは" # - # If `width <= self.size`, returns a copy of `self`: + # If width <= self.size, returns a copy of `self`: # # 'hello'.rjust(5, 'ab') # => "hello" # 'hello'.rjust(1, 'ab') # => "hello" @@ -4132,10 +4159,10 @@ class String # The pattern used is: # # * `pattern` itself, if it is a Regexp. - # * `Regexp.quote(pattern)`, if `pattern` is a string. + # * Regexp.quote(pattern), if `pattern` is a string. # - # Note that in the examples below, a returned string `'hello'` is a copy of - # `self`, not `self`. + # Note that in the examples below, a returned string 'hello' is a + # copy of `self`, not `self`. # # If `pattern` is a Regexp, searches for the last matching substring (also # setting [matched-data global @@ -4218,7 +4245,8 @@ class String # Matches a pattern against `self`: # # * If `pattern` is a Regexp, the pattern used is `pattern` itself. - # * If `pattern` is a string, the pattern used is `Regexp.quote(pattern)`. + # * If `pattern` is a string, the pattern used is + # Regexp.quote(pattern). # # Generates a collection of matching results and updates [regexp-related global # variables](rdoc-ref:Regexp@Global+Variables): @@ -4267,8 +4295,8 @@ class String # `replacement_string`. # # With no block given, replaces each invalid sequence with the given - # `default_replacement_string` (by default, `"�"` for a Unicode encoding, `'?'` - # otherwise): + # `default_replacement_string` (by default, "�" for a Unicode + # encoding, '?' otherwise): # # "foo\x81\x81bar"scrub # => "foo��bar" # "foo\x81\x81bar".force_encoding('US-ASCII').scrub # => "foo??bar" @@ -4340,7 +4368,7 @@ class String # # Returns the substring of `self` specified by the arguments. # - # **Form `self[index]`** + # Form self[index] # # With non-negative integer argument `index` given, returns the 1-character # substring found in self at character offset index: @@ -4358,7 +4386,7 @@ class String # 'hello'[-5] # => "h" # 'hello'[-6] # => nil # - # **Form `self[start, length]`** + # Form self[start, length] # # With integer arguments `start` and `length` given, returns a substring of size # `length` characters (as available) beginning at character offset specified by @@ -4385,10 +4413,10 @@ class String # # 'hello'[5, 3] # => "" # - # **Form `self[range]`** + # Form self[range] # - # With Range argument `range` given, forms substring `self[range.start, - # range.size]`: + # With Range argument `range` given, forms substring self[range.start, + # range.size]: # # 'hello'[0..2] # => "hel" # 'hello'[0, 3] # => "hel" @@ -4399,7 +4427,7 @@ class String # 'hello'[0, 0] # => "" # 'hello'[0...0] # => "" # - # **Form `self[regexp, capture = 0]`** + # Form self[regexp, capture = 0] # # With Regexp argument `regexp` given and `capture` as zero, searches for a # matching substring in `self`; updates [Regexp-related global @@ -4421,7 +4449,7 @@ class String # 'hello'[/(h)(e)(l+)(o)/, 4] # => "o" # 'hello'[/(h)(e)(l+)(o)/, 5] # => nil # - # **Form `self[substring]`** + # Form self[substring] # # With string argument `substring` given, returns the matching substring of # `self`, if found: @@ -4474,15 +4502,15 @@ class String # Creates an array of substrings by splitting `self` at each occurrence of the # given field separator `field_sep`. # - # With no arguments given, splits using the field separator `$;`, whose default - # value is `nil`. + # With no arguments given, splits using the field separator $;, + # whose default value is `nil`. # # With no block given, returns the array of substrings: # # 'abracadabra'.split('a') # => ["", "br", "c", "d", "br"] # - # When `field_sep` is `nil` or `' '` (a single space), splits at each sequence - # of whitespace: + # When `field_sep` is `nil` or ' ' (a single space), splits at each + # sequence of whitespace: # # 'foo bar baz'.split(nil) # => ["foo", "bar", "baz"] # 'foo bar baz'.split(' ') # => ["foo", "bar", "baz"] @@ -4497,8 +4525,8 @@ class String # 'тест'.split('') # => ["т", "е", "с", "т"] # 'こんにちは'.split('') # => ["こ", "ん", "に", "ち", "は"] # - # When `field_sep` is a non-empty string and different from `' '` (a single - # space), uses that string as the separator: + # When `field_sep` is a non-empty string and different from ' ' (a + # single space), uses that string as the separator: # # 'abracadabra'.split('a') # => ["", "br", "c", "d", "br"] # 'abracadabra'.split('ab') # => ["", "racad", "ra"] @@ -4528,7 +4556,8 @@ class String # 'abracadabra'.split('a', 0) # => ["", "br", "c", "d", "br"] # Empty string after last 'a' omitted. # # When `limit` is a positive integer, there is a limit on the size of the array - # (no more than `n - 1` splits occur), and trailing empty strings are included: + # (no more than n - 1 splits occur), and trailing empty strings are + # included: # # 'abracadabra'.split('', 3) # => ["a", "b", "racadabra"] # 'abracadabra'.split('a', 3) # => ["", "br", "cadabra"] @@ -4637,7 +4666,7 @@ class String # For each argument, the pattern used is: # # * The pattern itself, if it is a Regexp. - # * `Regexp.quote(pattern)`, if it is a string. + # * Regexp.quote(pattern), if it is a string. # # Returns `true` if any pattern matches the beginning, `false` otherwise: # @@ -4830,7 +4859,7 @@ class String # --> # Returns a basic `n`-bit [checksum](https://en.wikipedia.org/wiki/Checksum) of # the characters in `self`; the checksum is the sum of the binary value of each - # byte in `self`, modulo `2**n - 1`: + # byte in `self`, modulo 2**n - 1: # # 'hello'.sum # => 532 # 'hello'.sum(4) # => 4 @@ -4875,8 +4904,9 @@ class String # s = 'こんにちは' # s.swapcase == s # => true # - # The casing is affected by the given `mapping`, which may be `:ascii`, `:fold`, - # or `:turkic`; see [Case Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). + # The casing is affected by the given `mapping`, which may be + # :ascii, :fold, or :turkic; see [Case + # Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). # # Related: see [Converting to New # String](rdoc-ref:String@Converting+to+New+String). @@ -4913,8 +4943,9 @@ class String # (real and imaginary parts) or polar coordinates (magnitude and angle parts), # depending on an included or implied "separator" character: # - # * `'+'`, `'-'`, or no separator: rectangular coordinates. - # * `'@'`: polar coordinates. + # * '+', '-', or no separator: rectangular + # coordinates. + # * '@': polar coordinates. # # **In Brief** # @@ -4994,8 +5025,8 @@ class String # # **Rectangular Coordinates** # - # With separator `'+'` or `'-'`, or with no separator, interprets the values as - # rectangular coordinates: real and imaginary. + # With separator '+' or '-', or with no separator, + # interprets the values as rectangular coordinates: real and imaginary. # # With no separator, assigns a single value to either the real or the imaginary # part: @@ -5005,7 +5036,7 @@ class String # '1i'.to_c # => (0+1i) # Imaginary (trailing 'i'). # 'i'.to_c # => (0+1i) # Special case (imaginary 1). # - # With separator `'+'`, both parts positive (or zero): + # With separator '+', both parts positive (or zero): # # # Without trailing 'i'. # '+'.to_c # => (0+0i) # No values: defaults to zero. @@ -5017,7 +5048,7 @@ class String # '2+i'.to_c # => (2+1i) # Value before '+': real and imaginary 1. # '2+1i'.to_c # => (2+1i) # Values before and after '+': real and imaginary. # - # With separator `'-'`, negative imaginary part: + # With separator '-', negative imaginary part: # # # Without trailing 'i'. # '-'.to_c # => (0+0i) # No values: defaults to zero. @@ -5029,13 +5060,13 @@ class String # '2-i'.to_c # => (2-1i) # Value before '-': positive real, negative imaginary. # '2-1i'.to_c # => (2-1i) # Values before and after '-': positive real, negative imaginary. # - # Note that the suffixed character `'i'` may instead be one of `'I'`, `'j'`, or - # `'J'`, with the same effect. + # Note that the suffixed character 'i' may instead be one of + # 'I', 'j', or 'J', with the same effect. # # **Polar Coordinates** # - # With separator `'@'`) interprets the values as polar coordinates: magnitude - # and angle. + # With separator '@') interprets the values as polar coordinates: + # magnitude and angle. # # '2@'.to_c.polar # => [2, 0.0] # Value before '@': magnitude only. # # Values before and after '@': magnitude and angle. @@ -5048,8 +5079,9 @@ class String # # '1.0@0'.to_c # => (1+0.0i) # - # Note that in all cases, the suffixed character `'i'` may instead be one of - # `'I'`, `'j'`, `'J'`, with the same effect. + # Note that in all cases, the suffixed character 'i' may instead be + # one of 'I', 'j', 'J', with the same + # effect. # # See [Converting to Non-String](rdoc-ref:String@Converting+to+Non--5CString). # @@ -5081,7 +5113,8 @@ class String # - to_i(base = 10) -> integer # --> # Returns the result of interpreting leading characters in `self` as an integer - # in the given `base`; `base` must be either `0` or in range `(2..36)`: + # in the given `base`; `base` must be either `0` or in range + # (2..36): # # '123456'.to_i # => 123456 # '123def'.to_i(16) # => 1195503 @@ -5132,7 +5165,8 @@ class String # # 'BWV 1079'.to_r # => (0/1) # - # NOTE: `'0.3'.to_r` is equivalent to `3/10r`, but is different from `0.3.to_r`: + # NOTE: '0.3'.to_r is equivalent to 3/10r, but is + # different from 0.3.to_r: # # '0.3'.to_r # => (3/10) # 3/10r # => (3/10) @@ -5285,21 +5319,23 @@ class String # Argument `form` must be one of the following symbols (see [Unicode # normalization forms](https://unicode.org/reports/tr15/#Norm_Forms)): # - # * `:nfc`: Canonical decomposition, followed by canonical composition. - # * `:nfd`: Canonical decomposition. - # * `:nfkc`: Compatibility decomposition, followed by canonical composition. - # * `:nfkd`: Compatibility decomposition. + # * :nfc: Canonical decomposition, followed by canonical + # composition. + # * :nfd: Canonical decomposition. + # * :nfkc: Compatibility decomposition, followed by canonical + # composition. + # * :nfkd: Compatibility decomposition. # # The encoding of `self` must be one of: # - # * `Encoding::UTF_8`. - # * `Encoding::UTF_16BE`. - # * `Encoding::UTF_16LE`. - # * `Encoding::UTF_32BE`. - # * `Encoding::UTF_32LE`. - # * `Encoding::GB18030`. - # * `Encoding::UCS_2BE`. - # * `Encoding::UCS_4BE`. + # * Encoding::UTF_8. + # * Encoding::UTF_16BE. + # * Encoding::UTF_16LE. + # * Encoding::UTF_32BE. + # * Encoding::UTF_32LE. + # * Encoding::GB18030. + # * Encoding::UCS_2BE. + # * Encoding::UCS_4BE. # # Examples: # @@ -5329,7 +5365,8 @@ class String # Returns whether `self` is in the given `form` of Unicode normalization; see # String#unicode_normalize. # - # The `form` must be one of `:nfc`, `:nfd`, `:nfkc`, or `:nfkd`. + # The `form` must be one of :nfc, :nfd, + # :nfkc, or :nfkd. # # Examples: # @@ -5403,8 +5440,9 @@ class String # s = 'こんにちは' # s.upcase == s # => true # - # The casing is affected by the given `mapping`, which may be `:ascii`, `:fold`, - # or `:turkic`; see [Case Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). + # The casing is affected by the given `mapping`, which may be + # :ascii, :fold, or :turkic; see [Case + # Mappings](rdoc-ref:case_mapping.rdoc@Case+Mappings). # # Related: see [Converting to New # String](rdoc-ref:String@Converting+to+New+String). @@ -5437,8 +5475,8 @@ class String # --> # With a block given, calls the block with each `String` value returned by # successive calls to String#succ; the first value is `self`, the next is - # `self.succ`, and so on; the sequence terminates when value `other_string` is - # reached; returns `self`: + # self.succ, and so on; the sequence terminates when value + # `other_string` is reached; returns `self`: # # a = [] # 'a'.upto('f') {|c| a.push(c) } diff --git a/core/struct.rbs b/core/struct.rbs index 0b3113889..4068a603d 100644 --- a/core/struct.rbs +++ b/core/struct.rbs @@ -2,9 +2,9 @@ # Class Struct provides a convenient way to create a simple class that can store # and fetch values. # -# This example creates a subclass of `Struct`, `Struct::Customer`; the first -# argument, a string, is the name of the subclass; the other arguments, symbols, -# determine the *members* of the new subclass. +# This example creates a subclass of `Struct`, Struct::Customer; +# the first argument, a string, is the name of the subclass; the other +# arguments, symbols, determine the *members* of the new subclass. # # Customer = Struct.new('Customer', :name, :address, :zip) # Customer.name # => "Struct::Customer" @@ -18,7 +18,7 @@ # methods # => [:zip, :address=, :zip=, :address, :name, :name=] # # An instance of the subclass may be created, and its members assigned values, -# via method `::new`: +# via method ::new: # # joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) # joe # => # @@ -71,10 +71,10 @@ # # ### Methods for Comparing # -# * #==: Returns whether a given object is equal to `self`, using `==` to -# compare member values. -# * #eql?: Returns whether a given object is equal to `self`, using `eql?` to -# compare member values. +# * #==: Returns whether a given object is equal to `self`, using +# == to compare member values. +# * #eql?: Returns whether a given object is equal to `self`, using +# eql? to compare member values. # # ### Methods for Fetching # @@ -119,13 +119,13 @@ class Struct[Elem] # - Struct_subclass.new(*member_names) -> Struct_subclass_instance # - Struct_subclass.new(**member_names) -> Struct_subclass_instance # --> - # `Struct.new` returns a new subclass of `Struct`. The new subclass: + # Struct.new returns a new subclass of `Struct`. The new subclass: # # * May be anonymous, or may have the name given by `class_name`. # * May have members as given by `member_names`. # * May have initialization via ordinary arguments, or via keyword arguments # - # The new subclass has its own method `::new`; thus: + # The new subclass has its own method ::new; thus: # # Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo # f = Foo.new(0, 1) # => # @@ -133,7 +133,7 @@ class Struct[Elem] # **Class Name** # # With string argument `class_name`, returns a new subclass of `Struct` named - # `Struct::class_name`: + # Struct::class_name: # # Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo # Foo.name # => "Struct::Foo" @@ -158,7 +158,7 @@ class Struct[Elem] # dave # => # # dave.greeting # => "Hello Dave at 123 Main" # - # Output, from `Struct.new`: + # Output, from Struct.new: # # "The new subclass is Struct::Customer" # @@ -184,7 +184,7 @@ class Struct[Elem] # # A subclass returned by Struct.new has these singleton methods: # - # * Method `::new ` creates an instance of the subclass: + # * Method ::new creates an instance of the subclass: # # Foo.new # => # # Foo.new(0) # => # @@ -197,12 +197,13 @@ class Struct[Elem] # Foo.new(foo: 0, bar: 1, baz: 2) # # Raises ArgumentError: unknown keywords: baz # - # * Method `:inspect` returns a string representation of the subclass: + # * Method :inspect returns a string representation of the + # subclass: # # Foo.inspect # # => "Struct::Foo" # - # * Method `::members` returns an array of the member names: + # * Method ::members returns an array of the member names: # # Foo.members # => [:foo, :bar] # @@ -211,8 +212,8 @@ class Struct[Elem] # By default, the arguments for initializing an instance of the new subclass can # be both positional and keyword arguments. # - # Optional keyword argument `keyword_init:` allows to force only one type of - # arguments to be accepted: + # Optional keyword argument keyword_init: allows to force only one + # type of arguments to be accepted: # # KeywordsOnly = Struct.new(:foo, :bar, keyword_init: true) # KeywordsOnly.new(bar: 1, foo: 0) @@ -252,8 +253,8 @@ class Struct[Elem] # rdoc-file=struct.c # - StructClass::keyword_init? -> true or falsy value # --> - # Returns `true` if the class was initialized with `keyword_init: true`. - # Otherwise returns `nil` or `false`. + # Returns `true` if the class was initialized with keyword_init: + # true. Otherwise returns `nil` or `false`. # # Examples: # Foo = Struct.new(:a) @@ -272,8 +273,8 @@ class Struct[Elem] # Returns `true` if and only if the following are true; otherwise returns # `false`: # - # * `other.class == self.class`. - # * For each member name `name`, `other.name == self.name`. + # * other.class == self.class. + # * For each member name `name`, other.name == self.name. # # Examples: # @@ -294,8 +295,8 @@ class Struct[Elem] # Returns `true` if and only if the following are true; otherwise returns # `false`: # - # * `other.class == self.class`. - # * For each member name `name`, `other.name.eql?(self.name)`. + # * other.class == self.class. + # * For each member name `name`, other.name.eql?(self.name). # # Customer = Struct.new(:name, :address, :zip) # joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) @@ -483,8 +484,8 @@ class Struct[Elem] # # Raises NameError if `name` is not the name of a member. # - # With integer argument `n` given, returns `self.values[n]` if `n` is in range; - # see Array@Array+Indexes: + # With integer argument `n` given, returns self.values[n] if `n` is + # in range; see Array@Array+Indexes: # # joe[2] # => 12345 # joe[-2] # => "123 Maple, Anytown NC" diff --git a/core/symbol.rbs b/core/symbol.rbs index 935ab4380..824115ccf 100644 --- a/core/symbol.rbs +++ b/core/symbol.rbs @@ -8,8 +8,8 @@ # The same `Symbol` object will be created for a given name or string for the # duration of a program's execution, regardless of the context or meaning of # that name. Thus if `Fred` is a constant in one context, a method in another, -# and a class in a third, the `Symbol` `:Fred` will be the same object in all -# three contexts. +# and a class in a third, the `Symbol` :Fred will be the same +# object in all three contexts. # # module One # class Fred @@ -75,7 +75,8 @@ # given Regexp or other object; returns `nil` if no match is found. # * #[], #slice : Returns a substring of symbol determined by a given index, # start/length, or range, or string. -# * #empty?: Returns `true` if `self.length` is zero; `false` otherwise. +# * #empty?: Returns `true` if self.length is zero; `false` +# otherwise. # * #encoding: Returns the Encoding object that represents the encoding of # symbol. # * #end_with?: Returns `true` if symbol ends with any of the given strings. @@ -136,7 +137,7 @@ class Symbol # # Returns: # - # * `self.to_s <=> other.to_s`, if `other` is a symbol. + # * self.to_s <=> other.to_s, if `other` is a symbol. # * `nil`, otherwise. # # Examples: @@ -171,8 +172,8 @@ class Symbol # rdoc-file=string.c # - symbol =~ object -> integer or nil # --> - # Equivalent to `symbol.to_s =~ object`, including possible updates to global - # variables; see String#=~. + # Equivalent to symbol.to_s =~ object, including possible updates + # to global variables; see String#=~. # def =~: (Regexp regex) -> Integer? | [T] (String::_MatchAgainst[String, T] object) -> T @@ -185,7 +186,7 @@ class Symbol # - symbol[regexp, capture = 0] -> string or nil # - symbol[substring] -> string or nil # --> - # Equivalent to `symbol.to_s[]`; see String#[]. + # Equivalent to symbol.to_s[]; see String#[]. # def []: (int start, ?int length) -> String? | (range[int?] range) -> String? @@ -196,7 +197,7 @@ class Symbol # rdoc-file=string.c # - capitalize(mapping) -> symbol # --> - # Equivalent to `sym.to_s.capitalize.to_sym`. + # Equivalent to sym.to_s.capitalize.to_sym. # # See String#capitalize. # @@ -210,7 +211,7 @@ class Symbol # - casecmp(object) -> -1, 0, 1, or nil # --> # Like Symbol#<=>, but case-insensitive; equivalent to - # `self.to_s.casecmp(object.to_s)`: + # self.to_s.casecmp(object.to_s): # # lower = :abc # upper = :ABC @@ -276,7 +277,7 @@ class Symbol # rdoc-file=string.c # - downcase(mapping) -> symbol # --> - # Equivalent to `sym.to_s.downcase.to_sym`. + # Equivalent to sym.to_s.downcase.to_sym. # # See String#downcase. # @@ -291,7 +292,7 @@ class Symbol # rdoc-file=string.c # - empty? -> true or false # --> - # Returns `true` if `self` is `:''`, `false` otherwise. + # Returns `true` if `self` is :'', `false` otherwise. # def empty?: () -> bool @@ -299,7 +300,7 @@ class Symbol # rdoc-file=string.c # - encoding -> encoding # --> - # Equivalent to `self.to_s.encoding`; see String#encoding. + # Equivalent to self.to_s.encoding; see String#encoding. # def encoding: () -> Encoding @@ -307,7 +308,7 @@ class Symbol # rdoc-file=string.c # - end_with?(*strings) -> true or false # --> - # Equivalent to `self.to_s.end_with?`; see String#end_with?. + # Equivalent to self.to_s.end_with?; see String#end_with?. # def end_with?: (*string suffixes) -> bool @@ -341,7 +342,7 @@ class Symbol # rdoc-file=string.c # - length -> integer # --> - # Equivalent to `self.to_s.length`; see String#length. + # Equivalent to self.to_s.length; see String#length. # def length: () -> Integer @@ -350,8 +351,8 @@ class Symbol # - match(pattern, offset = 0) -> matchdata or nil # - match(pattern, offset = 0) {|matchdata| } -> object # --> - # Equivalent to `self.to_s.match`, including possible updates to global - # variables; see String#match. + # Equivalent to self.to_s.match, including possible updates to + # global variables; see String#match. # def match: (Regexp | string pattern, ?int offset) -> MatchData? | [T] (Regexp | string pattern, ?int offset) { (MatchData matchdata) -> T } -> T? @@ -360,12 +361,12 @@ class Symbol # rdoc-file=string.c # - match?(pattern, offset) -> true or false # --> - # Equivalent to `sym.to_s.match?`; see String#match. + # Equivalent to sym.to_s.match?; see String#match. # def match?: (Regexp | string pattern, ?int offset) -> bool # - # Equivalent to `self.to_s.succ.to_sym`: + # Equivalent to self.to_s.succ.to_sym: # # :foo.succ # => :fop # @@ -388,12 +389,12 @@ class Symbol def name: () -> String # - # Equivalent to `self.to_s.length`; see String#length. + # Equivalent to self.to_s.length; see String#length. # alias size length # - # Equivalent to `symbol.to_s[]`; see String#[]. + # Equivalent to symbol.to_s[]; see String#[]. # alias slice [] @@ -401,7 +402,7 @@ class Symbol # rdoc-file=string.c # - start_with?(*string_or_regexp) -> true or false # --> - # Equivalent to `self.to_s.start_with?`; see String#start_with?. + # Equivalent to self.to_s.start_with?; see String#start_with?. # def start_with?: (*Regexp | string prefixes) -> bool @@ -409,7 +410,7 @@ class Symbol # rdoc-file=string.c # - succ # --> - # Equivalent to `self.to_s.succ.to_sym`: + # Equivalent to self.to_s.succ.to_sym: # # :foo.succ # => :fop # @@ -421,7 +422,7 @@ class Symbol # rdoc-file=string.c # - swapcase(mapping) -> symbol # --> - # Equivalent to `sym.to_s.swapcase.to_sym`. + # Equivalent to sym.to_s.swapcase.to_sym. # # See String#swapcase. # @@ -470,7 +471,7 @@ class Symbol # rdoc-file=string.c # - upcase(mapping) -> symbol # --> - # Equivalent to `sym.to_s.upcase.to_sym`. + # Equivalent to sym.to_s.upcase.to_sym. # # See String#upcase. # diff --git a/core/thread.rbs b/core/thread.rbs index 11d17a090..d47803fc6 100644 --- a/core/thread.rbs +++ b/core/thread.rbs @@ -14,8 +14,8 @@ # # thr.join #=> "What's the big deal" # -# If we don't call `thr.join` before the main thread terminates, then all other -# threads including `thr` will be killed. +# If we don't call thr.join before the main thread terminates, then +# all other threads including `thr` will be killed. # # Alternatively, you can use an array for handling multiple threads at once, # like in the following example: @@ -105,8 +105,8 @@ # p Thread.current.thread_variable_get(:foo) # => 2 # }.join # -# You can see that the thread-local `:foo` carried over into the fiber and was -# changed to `2` by the end of the thread. +# You can see that the thread-local :foo carried over into the +# fiber and was changed to `2` by the end of the thread. # # This example makes use of #thread_variable_set to create new thread-locals, # and #thread_variable_get to reference them. @@ -617,13 +617,13 @@ class Thread < Object # --> # Returns the status of `thr`. # - # `"sleep"` + # "sleep" # : Returned if this thread is sleeping or waiting on I/O # - # `"run"` + # "run" # : When this thread is executing # - # `"aborting"` + # "aborting" # : If this thread is aborting # # `false` @@ -769,7 +769,8 @@ class Thread < Object # Marks a given thread as eligible for scheduling, however it may still remain # blocked on I/O. # - # **Note:** This does not invoke the scheduler, see #run for more information. + # Note: This does not invoke the scheduler, see #run for more + # information. # # c = Thread.new { Thread.stop; puts "hey!" } # sleep 0.1 while c.status!='sleep' @@ -790,7 +791,8 @@ class Thread < Object # When set to `true`, if any thread is aborted by an exception, the raised # exception will be re-raised in the main thread. # - # Can also be specified by the global $DEBUG flag or command line option `-d`. + # Can also be specified by the global $DEBUG flag or command line option + # -d. # # See also ::abort_on_exception=. # @@ -872,17 +874,17 @@ class Thread < Object # Thread#raise, Thread#kill, signal trap (not supported yet) and main thread # termination (if main thread terminates, then all other thread will be killed). # - # The given `hash` has pairs like `ExceptionClass => :TimingSymbol`. Where the - # ExceptionClass is the interrupt handled by the given block. The TimingSymbol - # can be one of the following symbols: + # The given `hash` has pairs like ExceptionClass => :TimingSymbol. + # Where the ExceptionClass is the interrupt handled by the given block. The + # TimingSymbol can be one of the following symbols: # - # `:immediate` + # :immediate # : Invoke interrupts immediately. # - # `:on_blocking` + # :on_blocking # : Invoke interrupts while *BlockingOperation*. # - # `:never` + # :never # : Never invoke all interrupts. # # @@ -906,8 +908,8 @@ class Thread < Object # # In this example, we can guard from Thread#raise exceptions. # - # Using the `:never` TimingSymbol the RuntimeError exception will always be - # ignored in the first block of the main thread. In the second + # Using the :never TimingSymbol the RuntimeError exception will + # always be ignored in the first block of the main thread. In the second # ::handle_interrupt block we can purposefully handle RuntimeError exceptions. # # th = Thread.new do @@ -1030,7 +1032,8 @@ class Thread < Object # Since Thread::handle_interrupt can be used to defer asynchronous events, this # method can be used to determine if there are any deferred events. # - # If you find this method returns true, then you may finish `:never` blocks. + # If you find this method returns true, then you may finish :never + # blocks. # # For example, the following method processes deferred asynchronous events # immediately. @@ -1108,9 +1111,9 @@ class Thread < Object # where it is raised rather then let it kill the Thread. # * If it is guaranteed the Thread will be joined with Thread#join or # Thread#value, then it is safe to disable this report with - # `Thread.current.report_on_exception = false` when starting the Thread. - # However, this might handle the exception much later, or not at all if the - # Thread is never joined due to the parent thread being blocked, etc. + # Thread.current.report_on_exception = false when starting the + # Thread. However, this might handle the exception much later, or not at all + # if the Thread is never joined due to the parent thread being blocked, etc. # # See also ::report_on_exception=. # @@ -1188,10 +1191,11 @@ class Thread::Backtrace < Object # rdoc-file=vm_backtrace.c # - Thread::Backtrace::limit -> integer # --> - # Returns maximum backtrace length set by `--backtrace-limit` command-line - # option. The default is `-1` which means unlimited backtraces. If the value is - # zero or positive, the error backtraces, produced by Exception#full_message, - # are abbreviated and the extra lines are replaced by `... 3 levels... ` + # Returns maximum backtrace length set by --backtrace-limit + # command-line option. The default is -1 which means unlimited + # backtraces. If the value is zero or positive, the error backtraces, produced + # by Exception#full_message, are abbreviated and the extra lines are replaced by + # ... 3 levels... # # $ ruby -r net/http -e "p Thread::Backtrace.limit; Net::HTTP.get(URI('http://wrong.address'))" # - 1 @@ -1257,7 +1261,7 @@ end # puts call.to_s # end # -# Running `ruby caller_locations.rb` will produce: +# Running ruby caller_locations.rb will produce: # # caller_locations.rb:2:in `a' # caller_locations.rb:5:in `b' @@ -1277,7 +1281,7 @@ end # puts call.to_s # end # -# Now run `ruby foo.rb` and you should see: +# Now run ruby foo.rb and you should see: # # init.rb:4:in `initialize' # init.rb:8:in `new' @@ -1360,7 +1364,8 @@ class Thread::Backtrace::Location # --> # Returns the line number of this frame. # - # For example, using `caller_locations.rb` from Thread::Backtrace::Location + # For example, using caller_locations.rb from + # Thread::Backtrace::Location # # loc = c(0..1).first # loc.lineno #=> 2 @@ -1375,7 +1380,8 @@ class Thread::Backtrace::Location # unless the frame is in the main script, in which case it will be the script # location passed on the command line. # - # For example, using `caller_locations.rb` from Thread::Backtrace::Location + # For example, using caller_locations.rb from + # Thread::Backtrace::Location # # loc = c(0..1).first # loc.path #=> caller_locations.rb @@ -1620,16 +1626,16 @@ class Thread::Queue[Elem = untyped] < Object # # After the call to close completes, the following are true: # - # * `closed?` will return true + # * closed? will return true # # * `close` will be ignored. # # * calling enq/push/<< will raise a `ClosedQueueError`. # - # * when `empty?` is false, calling deq/pop/shift will return an object from - # the queue as usual. - # * when `empty?` is true, deq(false) will not suspend the thread and will - # return nil. deq(true) will raise a `ThreadError`. + # * when empty? is false, calling deq/pop/shift will return an + # object from the queue as usual. + # * when empty? is true, deq(false) will not suspend the thread + # and will return nil. deq(true) will raise a `ThreadError`. # # ClosedQueueError is inherited from StopIteration, so that you can break loop # block. diff --git a/core/time.rbs b/core/time.rbs index 32083a4fc..84063e5f0 100644 --- a/core/time.rbs +++ b/core/time.rbs @@ -76,9 +76,9 @@ # integer. However `localtime` on some platforms doesn't supports negative # `time_t` (before 1970). # -# `struct tm` has *tm_year* member to represent years. (`tm_year = 0` means the -# year 1900.) It is defined as `int` in the C standard. *tm_year* can represent -# years between -2147481748 to 2147485547 if `int` is 32 bit. +# `struct tm` has *tm_year* member to represent years. (tm_year = 0 +# means the year 1900.) It is defined as `int` in the C standard. *tm_year* can +# represent years between -2147481748 to 2147485547 if `int` is 32 bit. # # Ruby supports leap seconds as far as if the C function `localtime` and # `gmtime` supports it. They use the tz database in most Unix systems. The tz @@ -259,9 +259,9 @@ # # Certain `Time` methods accept arguments that specify timezones: # -# * Time.at: keyword argument `in:`. -# * Time.new: positional argument `zone` or keyword argument `in:`. -# * Time.now: keyword argument `in:`. +# * Time.at: keyword argument in:. +# * Time.new: positional argument `zone` or keyword argument in:. +# * Time.now: keyword argument in:. # * Time#getlocal: positional argument `zone`. # * Time#localtime: positional argument `zone`. # @@ -276,11 +276,11 @@ # # ### Hours/Minutes Offsets # -# The zone value may be a string offset from UTC in the form `'+HH:MM'` or -# `'-HH:MM'`, where: +# The zone value may be a string offset from UTC in the form +# '+HH:MM' or '-HH:MM', where: # -# * `HH` is the 2-digit hour in the range `0..23`. -# * `MM` is the 2-digit minute in the range `0..59`. +# * `HH` is the 2-digit hour in the range 0..23. +# * `MM` is the 2-digit minute in the range 0..59. # # Examples: # @@ -290,8 +290,8 @@ # # ### Single-Letter Offsets # -# The zone value may be a letter in the range `'A'..'I'` or `'K'..'Z'`; see -# [List of military time +# The zone value may be a letter in the range 'A'..'I' or +# 'K'..'Z'; see [List of military time # zones](https://en.wikipedia.org/wiki/List_of_military_time_zones): # # t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC @@ -304,7 +304,7 @@ # ### Integer Offsets # # The zone value may be an integer number of seconds in the range -# `-86399..86399`: +# -86399..86399: # # t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC # Time.at(t, in: -86399) # => 1999-12-31 20:15:02 -235959 @@ -321,7 +321,7 @@ # * `local_to_utc`: # # Called when Time.new is invoked with `tz` as the value of positional -# argument `zone` or keyword argument `in:`. +# argument `zone` or keyword argument in:. # # Argument # : a [Time-like object](rdoc-ref:Time@Time-Like+Objects). @@ -334,8 +334,9 @@ # * `utc_to_local`: # # Called when Time.at or Time.now is invoked with `tz` as the value for -# keyword argument `in:`, and when Time#getlocal or Time#localtime is called -# with `tz` as the value for positional argument `zone`. +# keyword argument in:, and when Time#getlocal or +# Time#localtime is called with `tz` as the value for positional argument +# `zone`. # # The UTC offset will be calculated as the difference between the original # time and the returned object as an `Integer`. If the object is in fixed @@ -354,7 +355,8 @@ # # * `abbr`: # -# Called when Time#strftime is invoked with a format involving `%Z`. +# Called when Time#strftime is invoked with a format involving +# %Z. # # Argument # : a [Time-like object](rdoc-ref:Time@Time-Like+Objects). @@ -363,11 +365,12 @@ # : a string abbreviation for the timezone name. # # -# * `dst?`: +# * dst?: # # Called when Time.at or Time.now is invoked with `tz` as the value for -# keyword argument `in:`, and when Time#getlocal or Time#localtime is called -# with `tz` as the value for positional argument `zone`. +# keyword argument in:, and when Time#getlocal or +# Time#localtime is called with `tz` as the value for positional argument +# `zone`. # # Argument # : a [Time-like object](rdoc-ref:Time@Time-Like+Objects). @@ -378,7 +381,7 @@ # # * `name`: # -# Called when `Marshal.dump(t)` is invoked +# Called when Marshal.dump(t) is invoked # # Argument # : none. @@ -472,7 +475,7 @@ class Time < Object # Required argument `time` may be either of: # # * A `Time` object, whose value is the basis for the returned time; also - # influenced by optional keyword argument `in:` (see below). + # influenced by optional keyword argument in: (see below). # * A numeric number of [Epoch seconds](rdoc-ref:Time@Epoch+Seconds) for the # returned time. # @@ -490,29 +493,29 @@ class Time < Object # together to specify subseconds for the returned time; argument `units` # specifies the units for `subsec`: # - # * `:millisecond`: `subsec` in milliseconds: + # * :millisecond: `subsec` in milliseconds: # # Time.at(secs, 0, :millisecond) # => 2000-12-31 23:59:59 -0600 # Time.at(secs, 500, :millisecond) # => 2000-12-31 23:59:59.5 -0600 # Time.at(secs, 1000, :millisecond) # => 2001-01-01 00:00:00 -0600 # Time.at(secs, -1000, :millisecond) # => 2000-12-31 23:59:58 -0600 # - # * `:microsecond` or `:usec`: `subsec` in microseconds: + # * :microsecond or :usec: `subsec` in microseconds: # # Time.at(secs, 0, :microsecond) # => 2000-12-31 23:59:59 -0600 # Time.at(secs, 500000, :microsecond) # => 2000-12-31 23:59:59.5 -0600 # Time.at(secs, 1000000, :microsecond) # => 2001-01-01 00:00:00 -0600 # Time.at(secs, -1000000, :microsecond) # => 2000-12-31 23:59:58 -0600 # - # * `:nanosecond` or `:nsec`: `subsec` in nanoseconds: + # * :nanosecond or :nsec: `subsec` in nanoseconds: # # Time.at(secs, 0, :nanosecond) # => 2000-12-31 23:59:59 -0600 # Time.at(secs, 500000000, :nanosecond) # => 2000-12-31 23:59:59.5 -0600 # Time.at(secs, 1000000000, :nanosecond) # => 2001-01-01 00:00:00 -0600 # Time.at(secs, -1000000000, :nanosecond) # => 2000-12-31 23:59:58 -0600 # - # Optional keyword argument `in: zone` specifies the timezone for the returned - # time: + # Optional keyword argument in: zone specifies the timezone for the + # returned time: # # Time.at(secs, in: '+12:00') # => 2001-01-01 17:59:59 +1200 # Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200 @@ -797,7 +800,7 @@ class Time < Object # --> # Compares `self` with `other_time`; returns: # - # * `-1`, if `self` is less than `other_time`. + # * -1, if `self` is less than `other_time`. # * `0`, if `self` is equal to `other_time`. # * `1`, if `self` is greater then `other_time`. # * `nil`, if `self` and `other_time` are incomparable. @@ -825,9 +828,9 @@ class Time < Object def >=: (Time arg0) -> bool # - # Returns a string representation of `self`, formatted by `strftime('%a %b %e %T - # %Y')` or its shorthand version `strftime('%c')`; see [Formats for Dates and - # Times](rdoc-ref:strftime_formatting.rdoc): + # Returns a string representation of `self`, formatted by strftime('%a %b + # %e %T %Y') or its shorthand version strftime('%c'); see + # [Formats for Dates and Times](rdoc-ref:strftime_formatting.rdoc): # # t = Time.new(2000, 12, 31, 23, 59, 59, 0.5) # t.ctime # => "Sun Dec 31 23:59:59 2000" @@ -845,9 +848,9 @@ class Time < Object # rdoc-file=time.c # - ctime -> string # --> - # Returns a string representation of `self`, formatted by `strftime('%a %b %e %T - # %Y')` or its shorthand version `strftime('%c')`; see [Formats for Dates and - # Times](rdoc-ref:strftime_formatting.rdoc): + # Returns a string representation of `self`, formatted by strftime('%a %b + # %e %T %Y') or its shorthand version strftime('%c'); see + # [Formats for Dates and Times](rdoc-ref:strftime_formatting.rdoc): # # t = Time.new(2000, 12, 31, 23, 59, 59, 0.5) # t.ctime # => "Sun Dec 31 23:59:59 2000" @@ -877,8 +880,10 @@ class Time < Object # - deconstruct_keys(array_of_names_or_nil) -> hash # --> # Returns a hash of the name/value pairs, to use in pattern matching. Possible - # keys are: `:year`, `:month`, `:day`, `:yday`, `:wday`, `:hour`, `:min`, - # `:sec`, `:subsec`, `:dst`, `:zone`. + # keys are: :year, :month, :day, + # :yday, :wday, :hour, :min, + # :sec, :subsec, :dst, + # :zone. # # Possible usages: # @@ -1135,9 +1140,9 @@ class Time < Object # # => ["0", "1", "1", "0", "0", "0"] # Time.new(*a) # => 0000-01-01 00:00:00 -0600 # - # When positional argument `zone` or keyword argument `in:` is given, the new - # `Time` object is in the specified timezone. For the forms of argument `zone`, - # see [Timezone Specifiers](rdoc-ref:Time@Timezone+Specifiers): + # When positional argument `zone` or keyword argument in: is given, + # the new `Time` object is in the specified timezone. For the forms of argument + # `zone`, see [Timezone Specifiers](rdoc-ref:Time@Timezone+Specifiers): # # Time.new(2000, 1, 1, 0, 0, 0, '+12:00') # # => 2000-01-01 00:00:00 +1200 @@ -1146,9 +1151,9 @@ class Time < Object # Time.new(in: '-12:00') # # => 2022-08-23 08:49:26.1941467 -1200 # - # Since `in:` keyword argument just provides the default, so if the first - # argument in single string form contains time zone information, this keyword - # argument will be silently ignored. + # Since in: keyword argument just provides the default, so if the + # first argument in single string form contains time zone information, this + # keyword argument will be silently ignored. # # Time.new('2000-01-01 00:00:00 +0100', in: '-0500').utc_offset # => 3600 # diff --git a/core/trace_point.rbs b/core/trace_point.rbs index a4eea5f4e..ff7244f6c 100644 --- a/core/trace_point.rbs +++ b/core/trace_point.rbs @@ -21,62 +21,62 @@ # If you don't specify the types of events you want to listen for, TracePoint # will include all available events. # -# **Note:** Do not depend on the current event set, as this list is subject to -# change. Instead, it is recommended to specify the types of events you want to -# use. +# Note: Do not depend on the current event set, as this list is +# subject to change. Instead, it is recommended to specify the types of events +# you want to use. # # To filter what is traced, you can pass any number of the following as # `events`: # -# `:line` +# :line # : Execute an expression or statement on a new line. # -# `:class` +# :class # : Start a class or module definition. # -# `:end` +# :end # : Finish a class or module definition. # -# `:call` +# :call # : Call a Ruby method. # -# `:return` +# :return # : Return from a Ruby method. # -# `:c_call` +# :c_call # : Call a C-language routine. # -# `:c_return` +# :c_return # : Return from a C-language routine. # -# `:raise` +# :raise # : Raise an exception. # -# `:rescue` +# :rescue # : Rescue an exception. # -# `:b_call` +# :b_call # : Event hook at block entry. # -# `:b_return` +# :b_return # : Event hook at block ending. # -# `:a_call` +# :a_call # : Event hook at all calls (`call`, `b_call`, and `c_call`). # -# `:a_return` +# :a_return # : Event hook at all returns (`return`, `b_return`, and `c_return`). # -# `:thread_begin` +# :thread_begin # : Event hook at thread beginning. # -# `:thread_end` +# :thread_end # : Event hook at thread ending. # -# `:fiber_switch` +# :fiber_switch # : Event hook at fiber switch. # -# `:script_compiled` +# :script_compiled # : New Ruby code compiled (with `eval`, `load`, or `require`). # class TracePoint @@ -140,7 +140,7 @@ class TracePoint # # If called when reentrance is already allowed, it raises a RuntimeError. # - # **Example:** + # Example: # # # Without reentry # # --------------- @@ -223,8 +223,8 @@ class TracePoint # --> # Returns the generated binding object from the event. # - # Note that for `:c_call` and `:c_return` events, the method returns `nil`, - # since C methods themselves do not have bindings. + # Note that for :c_call and :c_return events, the + # method returns `nil`, since C methods themselves do not have bindings. # def binding: () -> Binding? @@ -259,12 +259,13 @@ class TracePoint # C.new.foo # end # - # **Note:** #defined_class returns the singleton class. + # Note: #defined_class returns the singleton class. # # The 6th block parameter of Kernel#set_trace_func passes the original class # attached by the singleton class. # - # **This is a difference between Kernel#set_trace_func and TracePoint.** + # This is a difference between Kernel#set_trace_func and + # TracePoint. # # class C; def self.foo; end; end # trace = TracePoint.new(:call) do |tp| @@ -432,8 +433,8 @@ class TracePoint # rdoc-file=trace_point.rb # - raised_exception() # --> - # Returns the exception raised on the `:raise` event or rescued on the `:rescue` - # event. + # Returns the exception raised on the :raise event or rescued on + # the :rescue event. # def raised_exception: () -> Exception @@ -441,7 +442,8 @@ class TracePoint # rdoc-file=trace_point.rb # - return_value() # --> - # Returns the return value from `:return`, `:c_return`, and `:b_return` events. + # Returns the return value from :return, :c_return, + # and :b_return events. # def return_value: () -> untyped @@ -452,7 +454,7 @@ class TracePoint # Returns the trace object during the event. # # Similar to the following, but it returns the correct object (the method - # receiver) for `:c_call` and `:c_return` events: + # receiver) for :c_call and :c_return events: # # trace.binding.eval('self') # @@ -463,7 +465,7 @@ class TracePoint # - eval_script() # --> # Returns the compiled source code (String) from eval methods on the - # `:script_compiled` event. If loaded from a file, it returns `nil`. + # :script_compiled event. If loaded from a file, it returns `nil`. # def eval_script: () -> String? @@ -472,7 +474,8 @@ class TracePoint # - instruction_sequence() # --> # Returns the compiled instruction sequence represented by a - # RubyVM::InstructionSequence instance on the `:script_compiled` event. + # RubyVM::InstructionSequence instance on the :script_compiled + # event. # # Note that this method is CRuby-specific. # diff --git a/core/true_class.rbs b/core/true_class.rbs index 89f4ed6e4..32009ad94 100644 --- a/core/true_class.rbs +++ b/core/true_class.rbs @@ -58,7 +58,7 @@ class TrueClass | (untyped obj) -> bool # - # Returns string `'true'`: + # Returns string 'true': # # true.to_s # => "true" # @@ -70,7 +70,7 @@ class TrueClass # rdoc-file=object.c # - true.to_s -> 'true' # --> - # Returns string `'true'`: + # Returns string 'true': # # true.to_s # => "true" # diff --git a/core/unbound_method.rbs b/core/unbound_method.rbs index 5ce696271..e31a56074 100644 --- a/core/unbound_method.rbs +++ b/core/unbound_method.rbs @@ -150,7 +150,7 @@ class UnboundMethod # - umeth.bind(obj) -> method # --> # Bind *umeth* to *obj*. If Klass was the class from which *umeth* was obtained, - # `obj.kind_of?(Klass)` must be true. + # obj.kind_of?(Klass) must be true. # # class A # def test @@ -170,7 +170,7 @@ class UnboundMethod # bm = um.bind(A.new) # bm.call # - # *produces:* + # produces: # # In test, class = C # In test, class = B @@ -199,12 +199,12 @@ class UnboundMethod # Net::HTTP.method(:get).inspect # #=> "#/lib/ruby/2.7.0/net/http.rb:457>" # - # `...` in argument definition means argument is optional (has some default - # value). + # ... in argument definition means argument is optional (has some + # default value). # # For methods defined in C (language core and extensions), location and argument # names can't be extracted, and only generic information is provided in form of - # `*` (any number of arguments) or `_` (some positional argument). + # * (any number of arguments) or `_` (some positional argument). # # "cat".method(:count).inspect #=> "#" # "cat".method(:+).inspect #=> "#"" @@ -227,12 +227,12 @@ class UnboundMethod # Net::HTTP.method(:get).inspect # #=> "#/lib/ruby/2.7.0/net/http.rb:457>" # - # `...` in argument definition means argument is optional (has some default - # value). + # ... in argument definition means argument is optional (has some + # default value). # # For methods defined in C (language core and extensions), location and argument # names can't be extracted, and only generic information is provided in form of - # `*` (any number of arguments) or `_` (some positional argument). + # * (any number of arguments) or `_` (some positional argument). # # "cat".method(:count).inspect #=> "#" # "cat".method(:+).inspect #=> "#"" @@ -330,8 +330,8 @@ class UnboundMethod # - umeth.bind_call(recv, args, ...) -> obj # --> # Bind *umeth* to *recv* and then invokes the method with the specified - # arguments. This is semantically equivalent to `umeth.bind(recv).call(args, - # ...)`. + # arguments. This is semantically equivalent to + # umeth.bind(recv).call(args, ...). # def bind_call: (untyped recv, *untyped, **untyped) ?{ (?) -> untyped } -> untyped end diff --git a/core/warning.rbs b/core/warning.rbs index 5117dbf42..48b68319d 100644 --- a/core/warning.rbs +++ b/core/warning.rbs @@ -5,11 +5,11 @@ # # Changing the behavior of Warning.warn is useful to customize how warnings are # handled by Ruby, for instance by filtering some warnings, and/or outputting -# warnings somewhere other than `$stderr`. +# warnings somewhere other than $stderr. # # If you want to change the behavior of Warning.warn you should use -# `Warning.extend(MyNewModuleWithWarnMethod)` and you can use `super` to get the -# default behavior of printing the warning to `$stderr`. +# Warning.extend(MyNewModuleWithWarnMethod) and you can use `super` +# to get the default behavior of printing the warning to $stderr. # # Example: # module MyWarningFilter @@ -41,18 +41,18 @@ module Warning # Returns the flag to show the warning messages for `category`. Supported # categories are: # - # `:deprecated` + # :deprecated # : deprecation warnings - # * assignment of non-nil value to `$,` and `$;` + # * assignment of non-nil value to $, and $; # * keyword arguments # etc. # # - # `:experimental` + # :experimental # : experimental features # # - # `:performance` + # :performance # : performance hints # * Shape variation limit # diff --git a/stdlib/cgi-escape/0/escape.rbs b/stdlib/cgi-escape/0/escape.rbs index 7ef1d01a9..a5e0e8878 100644 --- a/stdlib/cgi-escape/0/escape.rbs +++ b/stdlib/cgi-escape/0/escape.rbs @@ -25,7 +25,7 @@ class CGI # - escape(string) # --> # URL-encode a string into application/x-www-form-urlencoded. Space characters - # (`" "`) are encoded with plus signs (`"+"`) + # (" ") are encoded with plus signs ("+") # url_encoded_string = CGI.escape("'Stop!' said Fred") # # => "%27Stop%21%27+said+Fred" # @@ -55,7 +55,7 @@ class CGI # rdoc-file=lib/cgi/escape.rb # - escapeHTML(string) # --> - # Escape special characters in HTML, namely `'&\"<>` + # Escape special characters in HTML, namely '&\"<> # CGI.escapeHTML('Usage: foo "bar" ') # # => "Usage: foo "bar" <baz>" # @@ -65,8 +65,8 @@ class CGI # rdoc-file=lib/cgi/escape.rb # - escapeURIComponent(string) # --> - # URL-encode a string following RFC 3986 Space characters (`" "`) are encoded - # with (`"%20"`) + # URL-encode a string following RFC 3986 Space characters (" ") are + # encoded with ("%20") # url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred") # # => "%27Stop%21%27%20said%20Fred" # diff --git a/stdlib/coverage/0/coverage.rbs b/stdlib/coverage/0/coverage.rbs index a9ca35cb2..8b3500d7c 100644 --- a/stdlib/coverage/0/coverage.rbs +++ b/stdlib/coverage/0/coverage.rbs @@ -159,7 +159,7 @@ module Coverage # - Coverage.peek_result => hash # --> # Returns a hash that contains filename as key and coverage array as value. This - # is the same as `Coverage.result(stop: false, clear: false)`. + # is the same as Coverage.result(stop: false, clear: false). # # { # "file.rb" => [1, 2, nil], @@ -244,8 +244,9 @@ module Coverage # --> # Returns true if coverage measurement is supported for the given mode. # - # The mode should be one of the following symbols: `:lines`, `:oneshot_lines`, - # `:branches`, `:methods`, `:eval`. + # The mode should be one of the following symbols: :lines, + # :oneshot_lines, :branches, :methods, + # :eval. # # Example: # diff --git a/stdlib/date/0/date.rbs b/stdlib/date/0/date.rbs index ee9c2340b..99391e92d 100644 --- a/stdlib/date/0/date.rbs +++ b/stdlib/date/0/date.rbs @@ -165,8 +165,8 @@ class Date # # Date._parse('2001-02-03') # => {:year=>2001, :mon=>2, :mday=>3} # - # If `comp` is `true` and the given year is in the range `(0..99)`, the current - # century is supplied; otherwise, the year is taken as given: + # If `comp` is `true` and the given year is in the range (0..99), + # the current century is supplied; otherwise, the year is taken as given: # # Date._parse('01-02-03', true) # => {:year=>2001, :mon=>2, :mday=>3} # Date._parse('01-02-03', false) # => {:year=>1, :mon=>2, :mday=>3} @@ -508,8 +508,8 @@ class Date # Date.parse('20010203') # => # # Date.parse('3rd Feb 2001') # => # # - # If `comp` is `true` and the given year is in the range `(0..99)`, the current - # century is supplied; otherwise, the year is taken as given: + # If `comp` is `true` and the given year is in the range (0..99), + # the current century is supplied; otherwise, the year is taken as given: # # Date.parse('01-02-03', true) # => # # Date.parse('01-02-03', false) # => # @@ -800,7 +800,7 @@ class Date # --> # Compares `self` and `other`, returning: # - # * `-1` if `other` is larger. + # * -1 if `other` is larger. # * `0` if the two are equal. # * `1` if `other` is smaller. # * `nil` if the two are incomparable. @@ -822,7 +822,7 @@ class Date # d <=> DateTime.new(2022, 7, 27) # => 0 # d <=> DateTime.new(2022, 7, 28) # => -1 # - # * A numeric (compares `self.ajd` to `other`): + # * A numeric (compares self.ajd to `other`): # # d <=> 2459788 # => -1 # d <=> 2459787 # => 1 @@ -859,7 +859,7 @@ class Date # d === DateTime.new(2022, 7, 27) # => true # d === DateTime.new(2022, 7, 28) # => false # - # * A numeric (compares `self.jd` to `other`): + # * A numeric (compares self.jd to `other`): # # d === 2459788 # => true # d === 2459787 # => false @@ -928,9 +928,10 @@ class Date # rdoc-file=ext/date/date_core.c # - asctime -> string # --> - # Equivalent to #strftime with argument `'%a %b %e %T %Y'` (or its [shorthand + # Equivalent to #strftime with argument '%a %b %e %T %Y' (or its + # [shorthand # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie - # rs) `'%c'`): + # rs) '%c'): # # Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001" # @@ -939,9 +940,10 @@ class Date def asctime: () -> String # - # Equivalent to #strftime with argument `'%a %b %e %T %Y'` (or its [shorthand + # Equivalent to #strftime with argument '%a %b %e %T %Y' (or its + # [shorthand # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie - # rs) `'%c'`): + # rs) '%c'): # # Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001" # @@ -993,7 +995,8 @@ class Date # - deconstruct_keys(array_of_names_or_nil) -> hash # --> # Returns a hash of the name/value pairs, to use in pattern matching. Possible - # keys are: `:year`, `:month`, `:day`, `:wday`, `:yday`. + # keys are: :year, :month, :day, + # :wday, :yday. # # Possible usages: # @@ -1026,7 +1029,7 @@ class Date # rdoc-file=ext/date/date_core.c # - downto(min){|date| ... } -> self # --> - # Equivalent to #step with arguments `min` and `-1`. + # Equivalent to #step with arguments `min` and -1. # def downto: (Date min) { (Date) -> untyped } -> Date | (Date min) -> Enumerator[Date, Date] @@ -1071,8 +1074,8 @@ class Date # rdoc-file=ext/date/date_core.c # - httpdate -> string # --> - # Equivalent to #strftime with argument `'%a, %d %b %Y %T GMT'`; see [Formats - # for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): + # Equivalent to #strftime with argument '%a, %d %b %Y %T GMT'; see + # [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): # # Date.new(2001, 2, 3).httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT" # @@ -1093,9 +1096,10 @@ class Date # rdoc-file=ext/date/date_core.c # - iso8601 -> string # --> - # Equivalent to #strftime with argument `'%Y-%m-%d'` (or its [shorthand + # Equivalent to #strftime with argument '%Y-%m-%d' (or its + # [shorthand # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie - # rs) `'%F'`); + # rs) '%F'); # # Date.new(2001, 2, 3).iso8601 # => "2001-02-03" # @@ -1268,7 +1272,7 @@ class Date # rdoc-file=ext/date/date_core.c # - next_year(n = 1) -> new_date # --> - # Equivalent to #>> with argument `n * 12`. + # Equivalent to #>> with argument n * 12. # def next_year: (?Integer year) -> Date @@ -1292,7 +1296,7 @@ class Date # rdoc-file=ext/date/date_core.c # - prev_year(n = 1) -> new_date # --> - # Equivalent to #<< with argument `n * 12`. + # Equivalent to #<< with argument n * 12. # def prev_year: (?Integer year) -> Date @@ -1300,8 +1304,8 @@ class Date # rdoc-file=ext/date/date_core.c # - rfc2822 -> string # --> - # Equivalent to #strftime with argument `'%a, %-d %b %Y %T %z'`; see [Formats - # for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): + # Equivalent to #strftime with argument '%a, %-d %b %Y %T %z'; see + # [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): # # Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000" # @@ -1311,8 +1315,8 @@ class Date # rdoc-file=ext/date/date_core.c # - rfc3339 -> string # --> - # Equivalent to #strftime with argument `'%FT%T%:z'`; see [Formats for Dates and - # Times](rdoc-ref:language/strftime_formatting.rdoc): + # Equivalent to #strftime with argument '%FT%T%:z'; see [Formats + # for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): # # Date.new(2001, 2, 3).rfc3339 # => "2001-02-03T00:00:00+00:00" # @@ -1373,8 +1377,8 @@ class Date # Calls the block with specified dates; returns `self`. # # * The first `date` is `self`. - # * Each successive `date` is `date + step`, where `step` is the numeric step - # size in days. + # * Each successive `date` is date + step, where `step` is the + # numeric step size in days. # * The last date is the last one that is before or equal to `limit`, which # should be a Date object. # @@ -1462,7 +1466,7 @@ class Date # Returns a string representation of the date in `self` in [ISO 8601 extended # date # format](rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specificati - # ons) (`'%Y-%m-%d'`): + # ons) ('%Y-%m-%d'): # # Date.new(2001, 2, 3).to_s # => "2001-02-03" # @@ -1516,9 +1520,10 @@ class Date def wednesday?: () -> bool # - # Equivalent to #strftime with argument `'%Y-%m-%d'` (or its [shorthand + # Equivalent to #strftime with argument '%Y-%m-%d' (or its + # [shorthand # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie - # rs) `'%F'`); + # rs) '%F'); # # Date.new(2001, 2, 3).iso8601 # => "2001-02-03" # diff --git a/stdlib/date/0/date_time.rbs b/stdlib/date/0/date_time.rbs index f4aa0c0ab..b411bde77 100644 --- a/stdlib/date/0/date_time.rbs +++ b/stdlib/date/0/date_time.rbs @@ -24,10 +24,10 @@ # #=> # # # An optional argument, the offset, indicates the difference between the local -# time and UTC. For example, `Rational(3,24)` represents ahead of 3 hours of -# UTC, `Rational(-5,24)` represents behind of 5 hours of UTC. The offset should -# be -1 to +1, and its precision is assumed at most second. The default value is -# zero (equals to UTC). +# time and UTC. For example, Rational(3,24) represents ahead of 3 +# hours of UTC, Rational(-5,24) represents behind of 5 hours of +# UTC. The offset should be -1 to +1, and its precision is assumed at most +# second. The default value is zero (equals to UTC). # # DateTime.new(2001,2,3,4,5,6,Rational(3,24)) # #=> # @@ -39,7 +39,7 @@ # # An optional argument, the day of calendar reform (`start`), denotes a Julian # day number, which should be 2298874 to 2426355 or negative/positive infinity. -# The default value is `Date::ITALY` (2299161=1582-10-15). +# The default value is Date::ITALY (2299161=1582-10-15). # # A DateTime object has various methods. See each reference. # @@ -183,8 +183,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.httpdate: (String str, ?Integer start) -> DateTime @@ -203,8 +203,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.iso8601: (String str, ?Integer start) -> DateTime @@ -237,8 +237,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.jisx0301: (String str, ?Integer start) -> DateTime @@ -288,8 +288,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.parse: (String str, ?boolish complete, ?Integer start) -> DateTime @@ -305,8 +305,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.rfc2822: (String str, ?Integer start) -> DateTime @@ -321,8 +321,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.rfc3339: (String str, ?Integer start) -> DateTime @@ -338,8 +338,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.rfc822: (String str, ?Integer start) -> DateTime @@ -383,8 +383,8 @@ class DateTime < Date # #=> # # # Raise an ArgumentError when the string length is longer than *limit*. You can - # stop this check by passing `limit: nil`, but note that it may take a long time - # to parse. + # stop this check by passing limit: nil, but note that it may take + # a long time to parse. # def self.xmlschema: (String str, ?Integer start) -> DateTime @@ -393,8 +393,9 @@ class DateTime < Date # - deconstruct_keys(array_of_names_or_nil) -> hash # --> # Returns a hash of the name/value pairs, to use in pattern matching. Possible - # keys are: `:year`, `:month`, `:day`, `:wday`, `:yday`, `:hour`, `:min`, - # `:sec`, `:sec_fraction`, `:zone`. + # keys are: :year, :month, :day, + # :wday, :yday, :hour, :min, + # :sec, :sec_fraction, :zone. # # Possible usages: # diff --git a/stdlib/did_you_mean/0/did_you_mean.rbs b/stdlib/did_you_mean/0/did_you_mean.rbs index 3c11aeaea..19571863a 100644 --- a/stdlib/did_you_mean/0/did_you_mean.rbs +++ b/stdlib/did_you_mean/0/did_you_mean.rbs @@ -38,7 +38,7 @@ # # Occasionally, you may want to disable the `did_you_mean` gem for e.g. # debugging issues in the error object itself. You can disable it entirely by -# specifying `--disable-did_you_mean` option to the `ruby` command: +# specifying --disable-did_you_mean option to the `ruby` command: # # $ ruby --disable-did_you_mean -e "1.zeor?" # -e:1:in `
': undefined method `zeor?' for 1:Integer (NameError) @@ -55,7 +55,7 @@ # # Sometimes, you do not want to disable the gem entirely, but need to get the # original error message without suggestions (e.g. testing). In this case, you -# could use the `#original_message` method on the error object: +# could use the #original_message method on the error object: # # no_method_error = begin # 1.zeor? @@ -92,9 +92,9 @@ module DidYouMean end # - # The `DidYouMean::Formatter` is the basic, default formatter for the gem. The - # formatter responds to the `message_for` method and it returns a human readable - # string. + # The DidYouMean::Formatter is the basic, default formatter for the + # gem. The formatter responds to the `message_for` method and it returns a human + # readable string. # class Formatter # - # `MethodNameChecker::RB_RESERVED_WORDS` is the list of reserved words in Ruby - # that take an argument. Unlike `VariableNameChecker::RB_RESERVED_WORDS`, these - # reserved words require an argument, and a `NoMethodError` is raised due to the - # presence of the argument. + # MethodNameChecker::RB_RESERVED_WORDS is the list of reserved + # words in Ruby that take an argument. Unlike + # VariableNameChecker::RB_RESERVED_WORDS, these reserved words + # require an argument, and a `NoMethodError` is raised due to the presence of + # the argument. # # The `MethodNameChecker` will use this list to suggest a reversed word if a # `NoMethodError` is raised and found closest matches. # - # Also see `VariableNameChecker::RB_RESERVED_WORDS`. + # Also see VariableNameChecker::RB_RESERVED_WORDS. # RB_RESERVED_WORDS: Array[Symbol] @@ -295,19 +296,19 @@ module DidYouMean NAMES_TO_EXCLUDE: Hash[String, Array[Symbol]] # - # `VariableNameChecker::RB_RESERVED_WORDS` is the list of all reserved words in - # Ruby. They could be declared like methods are, and a typo would cause Ruby to - # raise a `NameError` because of the way they are declared. + # VariableNameChecker::RB_RESERVED_WORDS is the list of all + # reserved words in Ruby. They could be declared like methods are, and a typo + # would cause Ruby to raise a `NameError` because of the way they are declared. # - # The `:VariableNameChecker` will use this list to suggest a reversed word if a - # `NameError` is raised and found closest matches, excluding: + # The :VariableNameChecker will use this list to suggest a reversed + # word if a `NameError` is raised and found closest matches, excluding: # # * +do+ # * +if+ # * +in+ # * +or+ # - # Also see `MethodNameChecker::RB_RESERVED_WORDS`. + # Also see MethodNameChecker::RB_RESERVED_WORDS. # RB_RESERVED_WORDS: Array[Symbol] diff --git a/stdlib/erb/0/erb.rbs b/stdlib/erb/0/erb.rbs index a257e0add..7d49f11a2 100644 --- a/stdlib/erb/0/erb.rbs +++ b/stdlib/erb/0/erb.rbs @@ -15,7 +15,8 @@ # * You can call instance method ERB#result to get the *result*. # ERB supports tags of three kinds: # * [Expression tags](rdoc-ref:ERB@Expression+Tags): -# each begins with `'<%='`, ends with `'%>'`; contains a Ruby expression; +# each begins with '<%=', ends with '%>'; +# contains a Ruby expression; # in the result, the value of the expression replaces the entire tag: # template = 'The magic word is <%= magic_word %>.' # erb = ERB.new(template) @@ -24,20 +25,21 @@ # # The above call to #result passes argument `binding`, # which contains the binding of variable `magic_word` to its string value -# `'xyzzy'`. +# 'xyzzy'. # The below call to #result need not pass a binding, -# because its expression `Date::DAYNAMES` is globally defined. +# because its expression Date::DAYNAMES is globally defined. # ERB.new('Today is <%= Date::DAYNAMES[Date.today.wday] %>.').result # => "Today is Monday." # # * [Execution tags](rdoc-ref:ERB@Execution+Tags): -# each begins with `'<%'`, ends with `'%>'`; contains Ruby code to be -# executed: +# each begins with '<%', ends with '%>'; contains +# Ruby code to be executed: # template = '<% File.write("t.txt", "Some stuff.") %>' # ERB.new(template).result # File.read('t.txt') # => "Some stuff." # # * [Comment tags](rdoc-ref:ERB@Comment+Tags): -# each begins with `'<%#'`, ends with `'%>'`; contains comment text; +# each begins with '<%#', ends with '%>'; +# contains comment text; # in the result, the entire tag is omitted. # template = 'Some stuff;<%# Note to self: figure out what the stuff is. %> more stuff.' # ERB.new(template).result # => "Some stuff; more stuff." @@ -51,11 +53,11 @@ # # Details: # 1. A plain-text string is assigned to variable `template`. -# Its embedded [expression tag](rdoc-ref:ERB@Expression+Tags) `'<%= -# Time.now %>'` includes a Ruby expression, `Time.now`. +# Its embedded [expression tag](rdoc-ref:ERB@Expression+Tags) '<%= +# Time.now %>' includes a Ruby expression, Time.now. # 2. The string is put into a new ERB object, and stored in variable `erb`. -# 3. Method call `erb.result` generates a string that contains the run-time -# value of `Time.now`, +# 3. Method call erb.result generates a string that contains the +# run-time value of Time.now, # as computed at the time of the call. # The # ERB object may be re-used: @@ -71,13 +73,14 @@ # # Details: # 1. As before, a plain-text string is assigned to variable `template`. -# Its embedded [expression tag](rdoc-ref:ERB@Expression+Tags) `'<%= -# magic_word %>'` has a variable *name*, `magic_word`. +# Its embedded [expression tag](rdoc-ref:ERB@Expression+Tags) '<%= +# magic_word %>' has a variable *name*, `magic_word`. # 2. The string is put into a new ERB object, and stored in variable `erb`; # note that `magic_word` need not be defined before the ERB object is # created. -# 3. `magic_word = 'abracadabra'` assigns a value to variable `magic_word`. -# 4. Method call `erb.result(binding)` generates a string +# 3. magic_word = 'abracadabra' assigns a value to variable +# `magic_word`. +# 4. Method call erb.result(binding) generates a string # that contains the *value* of `magic_word`. # As before, the ERB object may be re-used: # magic_word = 'xyzzy' @@ -102,7 +105,7 @@ # That binding is sufficient for an expression tag that refers only to Ruby's # constants and variables; # these expression tags refer only to Ruby's global constant `RUBY_COPYRIGHT` -# and global variable `$0`: +# and global variable $0: # template = <