diff --git a/Gemfile.lock b/Gemfile.lock index 011ec9c27a..3f0a5f8217 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -128,7 +128,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (8.0.0) + rdoc (8.1.0) erb prism (>= 1.6.0) rbs (>= 4.0.0) diff --git a/core/complex.rbs b/core/complex.rbs index 09d344cd7e..ebd414ec5a 100644 --- a/core/complex.rbs +++ b/core/complex.rbs @@ -154,10 +154,7 @@ class Complex < Numeric # def self.polar: (Numeric, ?Numeric) -> Complex - # + # # Returns a new Complex object formed from the arguments, each of which must be # an instance of Numeric, or an instance of one of its subclasses: Complex, # Float, Integer, Rational; see [Rectangular @@ -694,16 +691,19 @@ class Complex < Numeric def real?: () -> false # - # Returns a new Complex object formed from the arguments, each of which must be - # an instance of Numeric, or an instance of one of its subclasses: Complex, - # Float, Integer, Rational; see [Rectangular - # Coordinates](rdoc-ref:Complex@Rectangular+Coordinates): + # Returns the array [self.real, self.imag]: # - # Complex.rect(3) # => (3+0i) - # Complex.rect(3, Math::PI) # => (3+3.141592653589793i) - # Complex.rect(-3, -Math::PI) # => (-3-3.141592653589793i) + # Complex.rect(1, 2).rect # => [1, 2] # - # Complex.rectangular is an alias for Complex.rect. + # See [Rectangular Coordinates](rdoc-ref:Complex@Rectangular+Coordinates). + # + # If `self` was created with [polar + # coordinates](rdoc-ref:Complex@Polar+Coordinates), the returned value is + # computed, and may be inexact: + # + # Complex.polar(1.0, 1.0).rect # => [0.5403023058681398, 0.8414709848078965] + # + # Complex#rectangular is an alias for Complex#rect. # def rect: () -> [ Numeric, Numeric ] diff --git a/core/dir.rbs b/core/dir.rbs index 259ae1dffb..ff90abf350 100644 --- a/core/dir.rbs +++ b/core/dir.rbs @@ -288,10 +288,7 @@ class Dir # def self.chroot: (path root) -> 0 - # + # # Removes the directory at `dirpath` from the underlying file system: # # Dir.rmdir('foo') # => 0 @@ -719,10 +716,7 @@ class Dir def self.open: (path dirname, ?encoding: encoding?) -> instance | [U] (path dirname, ?encoding: encoding?) { (instance) -> U } -> U - # + # # Returns the path to the current working directory: # # Dir.chdir("/tmp") # => 0 @@ -742,10 +736,7 @@ class Dir # alias self.rmdir self.delete - # + # # Removes the directory at `dirpath` from the underlying file system: # # Dir.rmdir('foo') # => 0 diff --git a/core/file.rbs b/core/file.rbs index a0c94094b4..7a42f2a9a7 100644 --- a/core/file.rbs +++ b/core/file.rbs @@ -1027,11 +1027,7 @@ class File < IO # def self.ctime: (path | IO file_name) -> Time - # + # # 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 @@ -1078,10 +1074,7 @@ class File < IO # def self.dirname: (path file_name, ?Integer level) -> String - # + # # Returns `true` if the named file exists and has a zero size. # # *file_name* can be an IO object. diff --git a/core/float.rbs b/core/float.rbs index dd4c1a7fda..e0bef3f4de 100644 --- a/core/float.rbs +++ b/core/float.rbs @@ -125,133 +125,6 @@ # representation of `self` in the given radix. # * #truncate: Returns `self` truncated to a given precision. # -# -# A Float object stores a real number using the native architecture's -# double-precision floating-point representation. -# -# ## Float Imprecisions -# -# Some real numbers can be represented precisely as Float objects: -# -# 37.5 # => 37.5 -# 98.75 # => 98.75 -# 12.3125 # => 12.3125 -# -# Others cannot; among these are the transcendental numbers, including: -# -# * 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): -# -# Math::PI # => 3.141592653589793 -# -# * Euler's number, *e*: in mathematics, a number of infinite precision: -# 2.7182818284590452353602874... (to 25 places); in Ruby, it is of limited -# precision (in this case, to 15 decimal places): -# -# Math::E # => 2.718281828459045 -# -# Some floating-point computations in Ruby give precise results: -# -# 1.0/2 # => 0.5 -# 100.0/8 # => 12.5 -# -# 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): -# -# 2.0/3 # => 0.6666666666666666 -# -# * In mathematics, the square root of 2 is an irrational number of infinite -# precision: 1.4142135623730950488016887... (to 25 decimal places); in Ruby, -# it is of limited precision (in this case, to 16 decimal places): -# -# Math.sqrt(2.0) # => 1.4142135623730951 -# -# * Even a simple computation can introduce imprecision: -# -# x = 0.1 + 0.2 # => 0.30000000000000004 -# y = 0.3 # => 0.3 -# x == y # => false -# -# See: -# -# * https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html -# * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rub -# ys-floats-imprecise -# * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems -# -# Note that precise storage and computation of rational numbers is possible -# using Rational objects. -# -# ## Creating a Float -# -# You can create a Float object explicitly with: -# -# * A [floating-point literal](rdoc-ref:syntax/literals.rdoc@Float+Literals). -# -# You can convert certain objects to Floats with: -# -# * Method #Float. -# -# ## What's Here -# -# First, what's elsewhere. Class Float: -# -# * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here) and [class -# Object](rdoc-ref:Object@What-27s+Here). -# * Includes [module Comparable](rdoc-ref:Comparable@What-27s+Here). -# -# Here, class Float provides methods for: -# -# * [Querying](rdoc-ref:Float@Querying) -# * [Comparing](rdoc-ref:Float@Comparing) -# * [Converting](rdoc-ref:Float@Converting) -# -# ### Querying -# -# * #finite?: Returns whether `self` is finite. -# * #hash: Returns the integer hash code for `self`. -# * #infinite?: Returns whether `self` is infinite. -# * #nan?: Returns whether `self` is a NaN (not-a-number). -# -# ### Comparing -# -# * #<: Returns whether `self` is less than the given value. -# * #<=: Returns whether `self` is less than or equal to the given value. -# * #<=>: Returns a number indicating whether `self` is less than, equal to, -# or greater than the given value. -# * #== (aliased as #=== and #eql?): Returns whether `self` is equal to the -# given value. -# * #>: Returns whether `self` is greater than the given value. -# * #>=: Returns whether `self` is greater than or equal to the given value. -# -# ### Converting -# -# * #% (aliased as #modulo): Returns `self` modulo the given value. -# * #*: Returns the product of `self` and the given value. -# * #**: Returns the value of `self` raised to the power of the given value. -# * #+: Returns the sum of `self` and the given value. -# * #-: Returns the difference of `self` and the given value. -# * #/: Returns the quotient of `self` and the given value. -# * #ceil: Returns the smallest number greater than or equal to `self`. -# * #coerce: Returns a 2-element array containing the given value converted to -# a Float and `self` -# * #divmod: Returns a 2-element array containing the quotient and remainder -# results of dividing `self` by the given value. -# * #fdiv: Returns the Float result of dividing `self` by the given value. -# * #floor: Returns the greatest number smaller than or equal to `self`. -# * #next_float: Returns the next-larger representable Float. -# * #prev_float: Returns the next-smaller representable Float. -# * #quo: Returns the quotient from dividing `self` by the given value. -# * #round: Returns `self` rounded to the nearest value, to a given precision. -# * #to_i (aliased as #to_int): Returns `self` truncated to an Integer. -# * #to_s (aliased as #inspect): Returns a string containing the place-value -# representation of `self` in the given radix. -# * #truncate: Returns `self` truncated to a given precision. -# class Float < Numeric # + # # 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`: @@ -1476,10 +1473,7 @@ module Process # def self.waitpid: (?Integer pid, ?Integer flags) -> Integer - # + # # Like Process.waitpid, but returns an array containing the child process `pid` # and Process::Status `status`: # diff --git a/core/rbs/unnamed/env_class.rbs b/core/rbs/unnamed/env_class.rbs index fce43234df..5c5ac3668c 100644 --- a/core/rbs/unnamed/env_class.rbs +++ b/core/rbs/unnamed/env_class.rbs @@ -272,11 +272,7 @@ module RBS %a{annotate:rdoc:copy:ENV.[]=} def []=: (String name, String? value) -> String? - # + # # Creates, updates, or deletes the named environment variable, returning the # value. Both `name` and `value` may be instances of String. See [Valid Names # and Values](rdoc-ref:ENV@Valid+Names+and+Values). @@ -344,13 +340,7 @@ module RBS def each: () -> ::Enumerator[[ String, String ], self] | () { ([ String, String ]) -> void } -> self - # + # # Yields each environment variable name and its value as a 2-element Array: # h = {} # ENV.each_pair { |name, value| h[name] = value } # => ENV @@ -596,13 +586,7 @@ module RBS def select: () -> ::Enumerator[[ String, String ], ::Hash[String, String]] | () { (String name, String value) -> boolish } -> ::Hash[String, String] - # + # # Yields each environment variable name and its value as a 2-element Array, # returning a Hash of the names and values for which the block returns a truthy # value: @@ -658,13 +642,7 @@ module RBS def select!: () -> ::Enumerator[[ String, String ], self?] | () { (String name, String value) -> boolish } -> self? - # + # # Yields each environment variable name and its value as a 2-element Array, # deleting each entry for which the block returns `false` or `nil`, and # returning ENV if any deletions made, or `nil` otherwise: @@ -798,15 +776,7 @@ module RBS def update: (Hash[String, String?]) -> self | (Hash[String, String?]) { (String name, String env_val, String? hash_val) -> String } -> self - # + # # Adds to ENV each key/value pair in the given `hash`; returns ENV: # ENV.replace('foo' => '0', 'bar' => '1') # ENV.merge!('baz' => '2', 'bat' => '3') # => {"bar"=>"1", "bat"=>"3", "baz"=>"2", "foo"=>"0"} @@ -907,11 +877,7 @@ module RBS %a{annotate:rdoc:copy:ENV.size} def size: () -> Integer - # + # # Returns the count of environment variables: # ENV.replace('foo' => '0', 'bar' => '1') # ENV.length # => 2 @@ -1019,13 +985,7 @@ module RBS %a{annotate:rdoc:copy:ENV.include?} def include?: (String name) -> bool - # + # # Returns `true` if there is an environment variable with the given `name`: # ENV.replace('foo' => '0', 'bar' => '1') # ENV.include?('foo') # => true @@ -1053,13 +1013,7 @@ module RBS %a{annotate:rdoc:copy:ENV.member?} alias member? include? - # + # # Returns `true` if there is an environment variable with the given `name`: # ENV.replace('foo' => '0', 'bar' => '1') # ENV.include?('foo') # => true @@ -1103,11 +1057,7 @@ module RBS %a{annotate:rdoc:copy:ENV.has_value?} def has_value?: (String value) -> bool - # + # # Returns `true` if `value` is the value for some environment variable name, # `false` otherwise: # ENV.replace('foo' => '0', 'bar' => '1') @@ -1119,13 +1069,7 @@ module RBS %a{annotate:rdoc:copy:ENV.value?} alias value? has_value? - # + # # Returns `true` if there is an environment variable with the given `name`: # ENV.replace('foo' => '0', 'bar' => '1') # ENV.include?('foo') # => true diff --git a/core/regexp.rbs b/core/regexp.rbs index f5f298258d..25700b3b79 100644 --- a/core/regexp.rbs +++ b/core/regexp.rbs @@ -1374,10 +1374,7 @@ class Regexp # alias self.compile self.new - # + # # Returns a new string that escapes any characters that have special meaning in # a regular expression: # diff --git a/core/string.rbs b/core/string.rbs index 3d4e3f4c50..88eec1372b 100644 --- a/core/string.rbs +++ b/core/string.rbs @@ -477,485 +477,6 @@ # * #upto: Calls the given block with each string value returned by successive # calls to #succ. # -# -# A `String` object has an arbitrary sequence of bytes, typically representing -# text or binary data. A `String` object may be created using String::new or as -# literals. -# -# String objects differ from Symbol objects in that Symbol objects are designed -# to be used as identifiers, instead of text or data. -# -# You can create a `String` object explicitly with: -# -# * A [string literal](rdoc-ref:syntax/literals.rdoc@String+Literals). -# * A [heredoc literal](rdoc-ref:syntax/literals.rdoc@Here+Document+Literals). -# -# You can convert certain objects to Strings with: -# -# * 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. -# -# 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 -# bang can also mutate, such as String#replace. -# -# ## Substitution Methods -# -# These methods perform substitutions: -# -# * String#sub: One substitution (or none); returns a new string. -# * String#sub!: One substitution (or none); returns `self` if any changes, -# `nil` otherwise. -# * String#gsub: Zero or more substitutions; returns a new string. -# * String#gsub!: Zero or more substitutions; returns `self` if any changes, -# `nil` otherwise. -# -# Each of these methods takes: -# -# * A first argument, `pattern` (String or Regexp), that specifies the -# substring(s) to be replaced. -# -# * Either of the following: -# -# * A second argument, `replacement` (String or Hash), that determines the -# replacing string. -# * A block that will determine the replacing string. -# -# 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` is commonly a regular expression: -# -# s = 'hello' -# s.sub(/[aeiou]/, '*') # => "h*llo" -# s.gsub(/[aeiou]/, '*') # => "h*ll*" -# s.gsub(/[aeiou]/, '') # => "hll" -# s.sub(/ell/, 'al') # => "halo" -# s.gsub(/xyzzy/, '*') # => "hello" -# 'THX1138'.gsub(/\d+/, '00') # => "THX00" -# -# When `pattern` is a string, all its characters are treated as ordinary -# characters (not as Regexp special characters): -# -# 'THX1138'.gsub('\d+', '00') # => "THX1138" -# -# `String` `replacement` -# -# If `replacement` is a string, that string determines the replacing string that -# is substituted for the matched text. -# -# Each of the examples above uses a simple string as the replacing string. -# -# `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`. -# -# 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. -# -# See Regexp for details. -# -# 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 -# "..\\&..". -# -# 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` -# -# If the argument `replacement` is a hash, and `pattern` matches one of its -# keys, the replacing string is the value for that key: -# -# h = {'foo' => 'bar', 'baz' => 'bat'} -# 'food'.sub('foo', h) # => "bard" -# -# Note that a symbol key does not match: -# -# h = {foo: 'bar', baz: 'bat'} -# 'food'.sub('foo', h) # => "d" -# -# **Block** -# -# In the block form, the current match string is passed to the block; the -# block's return value becomes the replacing string: -# -# s = '@' -# '1234'.gsub(/\d/) { |match| s.succ! } # => "ABCD" -# -# 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", " ". -# -# Whitespace is relevant for the following methods: -# -# * #lstrip, #lstrip!: Strip leading whitespace. -# * #rstrip, #rstrip!: Strip trailing whitespace. -# * #strip, #strip!: Strip leading and trailing whitespace. -# -# ## What's Here -# -# First, what's elsewhere. Class `String`: -# -# * Inherits from the [Object class](rdoc-ref:Object@What-27s+Here). -# * Includes the [Comparable module](rdoc-ref:Comparable@What-27s+Here). -# -# 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). -# * [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). -# -# ### Creating a String -# -# * ::new: Returns a new string. -# * ::try_convert: Returns a new string created from a given object. -# -# ### Freezing/Unfreezing -# -# * #+@: 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. -# * #freeze: Freezes `self` if not already frozen; returns `self`. -# -# ### Querying -# -# *Counts* -# -# * #bytesize: Returns the count of bytes. -# * #count: Returns the count of substrings matching given strings. -# * #empty?: Returns whether the length of `self` is zero. -# * #length (aliased as #size): Returns the count of characters (not bytes). -# -# *Substrings* -# -# * #=~: Returns the index of the first substring that matches a given Regexp -# or other object; returns `nil` if no match is found. -# * #byteindex: Returns the byte index of the first occurrence of a given -# substring. -# * #byterindex: Returns the byte index of the last occurrence of a given -# substring. -# * #index: Returns the index of the *first* occurrence of a given substring; -# returns `nil` if none found. -# * #rindex: Returns the index of the *last* occurrence of a given substring; -# returns `nil` if none found. -# * #include?: Returns `true` if the string contains a given substring; -# `false` otherwise. -# * #match: Returns a MatchData object if the string matches a given Regexp; -# `nil` otherwise. -# * #match?: Returns `true` if the string matches a given Regexp; `false` -# otherwise. -# * #start_with?: Returns `true` if the string begins with any of the given -# substrings. -# * #end_with?: Returns `true` if the string ends with any of the given -# substrings. -# -# *Encodings* -# -# * #encoding: Returns the Encoding object that represents the encoding of the -# string. -# * #unicode_normalized?: Returns `true` if the string is in Unicode -# normalized form; `false` otherwise. -# * #valid_encoding?: Returns `true` if the string contains only characters -# that are valid for its encoding. -# * #ascii_only?: Returns `true` if the string has only ASCII characters; -# `false` otherwise. -# -# *Other* -# -# * #sum: Returns a basic checksum for the string: the sum of each byte. -# * #hash: Returns the integer hash code. -# -# ### Comparing -# -# * #== (aliased as #===): Returns `true` if a given other string has the same -# content as `self`. -# * #eql?: Returns `true` if the content is the same as the given other -# string. -# * #<=>: Returns -1, 0, or 1 as a given other string is smaller than, equal -# to, or larger than `self`. -# * #casecmp: Ignoring case, returns -1, 0, or 1 as `self` is smaller than, -# equal to, or larger than a given other string. -# * #casecmp?: Ignoring case, returns whether a given other string is equal to -# `self`. -# -# ### Modifying -# -# Each of these methods modifies `self`. -# -# *Insertion* -# -# * #insert: Returns `self` with a given string inserted at a specified -# offset. -# * #<<: Returns `self` concatenated with a given string or integer. -# * #append_as_bytes: Returns `self` concatenated with strings without -# performing any encoding validation or conversion. -# * #prepend: Prefixes to `self` the concatenation of given other strings. -# -# *Substitution* -# -# * #bytesplice: Replaces bytes of `self` with bytes from a given string; -# returns `self`. -# * #sub!: Replaces the first substring that matches a given pattern with a -# given replacement string; returns `self` if any changes, `nil` otherwise. -# * #gsub!: Replaces each substring that matches a given pattern with a given -# replacement string; returns `self` if any changes, `nil` otherwise. -# * #succ! (aliased as #next!): Returns `self` modified to become its own -# successor. -# * #replace: Returns `self` with its entire content replaced by a given -# string. -# * #reverse!: Returns `self` with its characters in reverse order. -# * #setbyte: Sets the byte at a given integer offset to a given value; -# returns the argument. -# * #tr!: Replaces specified characters in `self` with specified replacement -# characters; returns `self` if any changes, `nil` otherwise. -# * #tr_s!: Replaces specified characters in `self` with specified replacement -# characters, removing duplicates from the substrings that were modified; -# returns `self` if any changes, `nil` otherwise. -# -# *Casing* -# -# * #capitalize!: Upcases the initial character and downcases all others; -# returns `self` if any changes, `nil` otherwise. -# * #downcase!: Downcases all characters; returns `self` if any changes, `nil` -# otherwise. -# * #upcase!: Upcases all characters; returns `self` if any changes, `nil` -# otherwise. -# * #swapcase!: Upcases each downcase character and downcases each upcase -# character; returns `self` if any changes, `nil` otherwise. -# -# *Encoding* -# -# * #encode!: Returns `self` with all characters transcoded from one encoding -# to another. -# * #unicode_normalize!: Unicode-normalizes `self`; returns `self`. -# * #scrub!: Replaces each invalid byte with a given character; returns -# `self`. -# * #force_encoding: Changes the encoding to a given encoding; returns `self`. -# -# *Deletion* -# -# * #clear: Removes all content, so that `self` is empty; returns `self`. -# * #slice!, #[]=: Removes a substring determined by a given index, -# start/length, range, regexp, or substring. -# * #squeeze!: Removes contiguous duplicate characters; returns `self`. -# * #delete!: Removes characters as determined by the intersection of -# substring arguments. -# * #delete_prefix!: Removes leading prefix; returns `self` if any changes, -# `nil` otherwise. -# * #delete_suffix!: Removes trailing suffix; returns `self` if any changes, -# `nil` otherwise. -# * #lstrip!: Removes leading whitespace; returns `self` if any changes, `nil` -# otherwise. -# * #rstrip!: Removes trailing whitespace; returns `self` if any changes, -# `nil` otherwise. -# * #strip!: Removes leading and trailing whitespace; returns `self` if any -# changes, `nil` otherwise. -# * #chomp!: Removes the trailing record separator, if found; returns `self` -# if any changes, `nil` otherwise. -# * #chop!: Removes trailing newline characters if found; otherwise removes -# the last character; returns `self` if any changes, `nil` otherwise. -# -# ### Converting to New String -# -# Each of these methods returns a new `String` based on `self`, often just a -# modified copy of `self`. -# -# *Extension* -# -# * #*: Returns the concatenation of multiple copies of `self`. -# * #+: Returns the concatenation of `self` and a given other string. -# * #center: Returns a copy of `self`, centered by specified padding. -# * #concat: Returns the concatenation of `self` with given other strings. -# * #ljust: Returns a copy of `self` of a given length, right-padded with a -# given other string. -# * #rjust: Returns a copy of `self` of a given length, left-padded with a -# given other string. -# -# *Encoding* -# -# * #b: Returns a copy of `self` with ASCII-8BIT encoding. -# * #scrub: Returns a copy of `self` with each invalid byte replaced with a -# given character. -# * #unicode_normalize: Returns a copy of `self` with each character -# Unicode-normalized. -# * #encode: Returns a copy of `self` with all characters transcoded from one -# encoding to another. -# -# *Substitution* -# -# * #dump: Returns a printable version of `self`, enclosed in double-quotes. -# * #undump: Inverse of #dump; returns a copy of `self` with changes of the -# kinds made by #dump "undone." -# * #sub: Returns a copy of `self` with the first substring matching a given -# pattern replaced with a given replacement string. -# * #gsub: Returns a copy of `self` with each substring that matches a given -# pattern replaced with a given replacement string. -# * #succ (aliased as #next): Returns the string that is the successor to -# `self`. -# * #reverse: Returns a copy of `self` with its characters in reverse order. -# * #tr: Returns a copy of `self` with specified characters replaced with -# specified replacement characters. -# * #tr_s: Returns a copy of `self` with specified characters replaced with -# specified replacement characters, removing duplicates from the substrings -# that were modified. -# * #%: Returns the string resulting from formatting a given object into -# `self`. -# -# *Casing* -# -# * #capitalize: Returns a copy of `self` with the first character upcased and -# all other characters downcased. -# * #downcase: Returns a copy of `self` with all characters downcased. -# * #upcase: Returns a copy of `self` with all characters upcased. -# * #swapcase: Returns a copy of `self` with all upcase characters downcased -# and all downcase characters upcased. -# -# *Deletion* -# -# * #delete: Returns a copy of `self` with characters removed. -# * #delete_prefix: Returns a copy of `self` with a given prefix removed. -# * #delete_suffix: Returns a copy of `self` with a given suffix removed. -# * #lstrip: Returns a copy of `self` with leading whitespace removed. -# * #rstrip: Returns a copy of `self` with trailing whitespace removed. -# * #strip: Returns a copy of `self` with leading and trailing whitespace -# removed. -# * #chomp: Returns a copy of `self` with a trailing record separator removed, -# if found. -# * #chop: Returns a copy of `self` with trailing newline characters or the -# last character removed. -# * #squeeze: Returns a copy of `self` with contiguous duplicate characters -# removed. -# * #[] (aliased as #slice): Returns a substring determined by a given index, -# start/length, range, regexp, or string. -# * #byteslice: Returns a substring determined by a given index, start/length, -# or range. -# * #chr: Returns the first character. -# -# *Duplication* -# -# * #to_s (aliased as #to_str): If `self` is a subclass of `String`, returns -# `self` copied into a `String`; otherwise, returns `self`. -# -# ### Converting to Non-String -# -# Each of these methods converts the contents of `self` to a non-`String`. -# -# Characters, Bytes, and Clusters -# -# * #bytes: Returns an array of the bytes in `self`. -# * #chars: Returns an array of the characters in `self`. -# * #codepoints: Returns an array of the integer ordinals in `self`. -# * #getbyte: Returns the integer byte at the given index in `self`. -# * #grapheme_clusters: Returns an array of the grapheme clusters in `self`. -# -# *Splitting* -# -# * #lines: Returns an array of the lines in `self`, as determined by a given -# record separator. -# * #partition: Returns a 3-element array determined by the first substring -# that matches a given substring or regexp. -# * #rpartition: Returns a 3-element array determined by the last substring -# that matches a given substring or regexp. -# * #split: Returns an array of substrings determined by a given delimiter -- -# regexp or string -- or, if a block is given, passes those substrings to -# the block. -# -# *Matching* -# -# * #scan: Returns an array of substrings matching a given regexp or string, -# or, if a block is given, passes each matching substring to the block. -# * #unpack: Returns an array of substrings extracted from `self` according to -# a given format. -# * #unpack1: Returns the first substring extracted from `self` according to a -# given format. -# -# *Numerics* -# -# * #hex: Returns the integer value of the leading characters, interpreted as -# hexadecimal digits. -# * #oct: Returns the integer value of the leading characters, interpreted as -# octal digits. -# * #ord: Returns the integer ordinal of the first character in `self`. -# * #to_c: Returns the complex value of leading characters, interpreted as a -# complex number. -# * #to_i: Returns the integer value of leading characters, interpreted as an -# integer. -# * #to_f: Returns the floating-point value of leading characters, interpreted -# as a floating-point number. -# * #to_r: Returns the rational value of leading characters, interpreted as a -# rational. -# -# *Strings and Symbols* -# -# * #inspect: Returns a copy of `self`, enclosed in double quotes, with -# special characters escaped. -# * #intern (aliased as #to_sym): Returns the symbol corresponding to `self`. -# -# ### Iterating -# -# * #each_byte: Calls the given block with each successive byte in `self`. -# * #each_char: Calls the given block with each successive character in -# `self`. -# * #each_codepoint: Calls the given block with each successive integer -# codepoint in `self`. -# * #each_grapheme_cluster: Calls the given block with each successive -# grapheme cluster in `self`. -# * #each_line: Calls the given block with each successive line in `self`, as -# determined by a given record separator. -# * #upto: Calls the given block with each string value returned by successive -# calls to #succ. -# class String include Comparable diff --git a/core/thread.rbs b/core/thread.rbs index 70b9680351..4ce6bc7a6b 100644 --- a/core/thread.rbs +++ b/core/thread.rbs @@ -1189,11 +1189,7 @@ class Thread < Object # def self.start: (*untyped args) { (?) -> void } -> instance - # + # # Basically the same as ::new. However, if class Thread is subclassed, then # calling `start` in that subclass will not invoke the subclass's `initialize` # method. diff --git a/stdlib/date/0/date.rbs b/stdlib/date/0/date.rbs index 99391e92dc..f1e2c63ed5 100644 --- a/stdlib/date/0/date.rbs +++ b/stdlib/date/0/date.rbs @@ -213,10 +213,7 @@ class Date # def self._rfc3339: (String str) -> Hash[Symbol, Integer | String] - # + # # Returns a hash of values parsed from `string`, which should be a valid [RFC # 2822 date format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format): # @@ -444,10 +441,7 @@ class Date # def self.julian_leap?: (Integer year) -> bool - # + # # Returns `true` if the given year is a leap year in the [proleptic Gregorian # calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar), `false` # otherwise: @@ -565,10 +559,7 @@ class Date # def self.rfc3339: (String str, ?Integer start) -> Date - # + # # Returns a new Date object with values parsed from `string`, which should be a # valid [RFC 2822 date # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format): @@ -660,10 +651,7 @@ class Date # def self.valid_commercial?: (Integer cwyear, Integer cweek, Integer cwday, ?Integer start) -> bool - # + # # Returns `true` if the arguments define a valid ordinal date, `false` # otherwise: # @@ -1323,20 +1311,10 @@ class Date def rfc3339: () -> String # - # Returns a new Date object with values parsed from `string`, which should be a - # valid [RFC 2822 date - # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format): - # - # d = Date.new(2001, 2, 3) - # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000" - # Date.rfc2822(s) # => # - # - # See: - # - # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start). - # * Argument [limit](rdoc-ref:Date@Argument+limit). + # Equivalent to #strftime with argument '%a, %-d %b %Y %T %z'; see + # [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc): # - # Related: Date._rfc2822 (returns a hash). + # Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000" # def rfc822: () -> String diff --git a/stdlib/date/0/date_time.rbs b/stdlib/date/0/date_time.rbs index b411bde776..cf64bf27f7 100644 --- a/stdlib/date/0/date_time.rbs +++ b/stdlib/date/0/date_time.rbs @@ -131,10 +131,7 @@ # eventually timezones. # class DateTime < Date - # + # # Same as DateTime.new. # def initialize: (?Integer year, ?Integer month, ?Integer mday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> void @@ -326,11 +323,7 @@ class DateTime < Date # def self.rfc3339: (String str, ?Integer start) -> DateTime - # + # # Creates a new DateTime object by parsing from a string according to some # typical RFC 2822 formats. # diff --git a/stdlib/net-http/0/net-http.rbs b/stdlib/net-http/0/net-http.rbs index b54eb936ab..b1ee16ffa8 100644 --- a/stdlib/net-http/0/net-http.rbs +++ b/stdlib/net-http/0/net-http.rbs @@ -4004,8 +4004,8 @@ module Net # in fragments, as it is read in from the socket. # # If `dest` argument is given, response is read into that variable, with - # `dest#<<` method (it could be String or IO, or any other object responding to - # `<<`). + # dest#<< method (it could be String or IO, or any other object + # responding to <<). # # Calling this method a second or subsequent time for the same HTTPResponse # object will return the value already read. diff --git a/stdlib/socket/0/socket.rbs b/stdlib/socket/0/socket.rbs index 63cb987faa..627e730e48 100644 --- a/stdlib/socket/0/socket.rbs +++ b/stdlib/socket/0/socket.rbs @@ -340,11 +340,7 @@ class Socket < BasicSocket # def self.ip_address_list: () -> Array[Addrinfo] - # + # # Packs *port* and *host* as an AF_INET/AF_INET6 sockaddr string. # # Socket.sockaddr_in(80, "127.0.0.1") @@ -355,22 +351,14 @@ class Socket < BasicSocket # def self.pack_sockaddr_in: (Integer port, String ip) -> String - # + # # Packs *path* as an AF_UNIX sockaddr string. # # Socket.sockaddr_un("/tmp/sock") #=> "\x01\x00/tmp/sock\x00\x00..." # def self.pack_sockaddr_un: (String sockpath) -> String - # + # # Creates a pair of sockets connected each other. # # *domain* should be a communications domain such as: :INET, :INET6, :UNIX, etc. diff --git a/stdlib/socket/0/unix_socket.rbs b/stdlib/socket/0/unix_socket.rbs index a7b2dad7c7..b68c640fe3 100644 --- a/stdlib/socket/0/unix_socket.rbs +++ b/stdlib/socket/0/unix_socket.rbs @@ -2,11 +2,7 @@ # UNIXSocket represents a UNIX domain stream client socket. # class UNIXSocket < BasicSocket - # + # # Creates a pair of sockets connected to each other. # # *type* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.