@@ -40,7 +40,7 @@ def class
4040 # s1.inspect #=> "#<Klass:0x401b3a38 @str=\"Hi\">"
4141 # s2.inspect #=> "#<Klass:0x401b3998 @str=\"Hi\">"
4242 #
43- # This method may have class-specific behavior. If so, that
43+ # This method may have class-specific behavior. If so, that
4444 # behavior will be documented under the #+initialize_copy+ method of
4545 # the class.
4646 #
@@ -73,7 +73,7 @@ def frozen?
7373 # call-seq:
7474 # obj.tap {|x| block } -> obj
7575 #
76- # Yields self to the block, and then returns self.
76+ # Yields self to the block and then returns self.
7777 # The primary purpose of this method is to "tap into" a method chain,
7878 # in order to perform operations on intermediate results within the chain.
7979 #
@@ -100,7 +100,7 @@ def tap
100100 #
101101 # 3.next.then {|x| x**x }.to_s #=> "256"
102102 #
103- # Good usage for +then+ is value piping in method chains:
103+ # A good use of +then+ is value piping in method chains:
104104 #
105105 # require 'open-uri'
106106 # require 'json'
@@ -109,13 +109,13 @@ def tap
109109 # .then {|url| URI(url).read }
110110 # .then {|response| JSON.parse(response) }
111111 #
112- # When called without block, the method returns +Enumerator+,
112+ # When called without a block, the method returns an +Enumerator+,
113113 # which can be used, for example, for conditional
114114 # circuit-breaking:
115115 #
116- # # meets condition, no-op
116+ # # Meets condition, no-op
117117 # 1.then.detect(&:odd?) # => 1
118- # # does not meet condition, drop value
118+ # # Does not meet condition, drop value
119119 # 2.then.detect(&:odd?) # => nil
120120 #
121121 def then
@@ -145,7 +145,7 @@ def then
145145 # # ...
146146 # end
147147 #
148- # StopIteration raised in the block breaks the loop. In this case,
148+ # A StopIteration raised in the block breaks the loop. In this case,
149149 # loop returns the "result" value stored in the exception.
150150 #
151151 # enum = Enumerator.new { |y|
@@ -178,10 +178,10 @@ def loop
178178 #
179179 # Returns <i>arg</i> converted to a float. Numeric types are
180180 # converted directly, and with exception to String and
181- # <code>nil</code> the rest are converted using
182- # <i>arg</i><code>.to_f</code>. Converting a String with invalid
183- # characters will result in a ArgumentError. Converting
184- # <code>nil</code> generates a TypeError. Exceptions can be
181+ # <code>nil</code>, the rest are converted using
182+ # <i>arg</i><code>.to_f</code>. Converting a String with invalid
183+ # characters will result in an ArgumentError. Converting
184+ # <code>nil</code> generates a TypeError. Exceptions can be
185185 # suppressed by passing <code>exception: false</code>.
186186 #
187187 # Float(1) #=> 1.0
@@ -210,22 +210,22 @@ def Float(arg, exception: true)
210210 # With a non-zero +base+, +object+ must be a string or convertible
211211 # to a string.
212212 #
213- # ==== numeric objects
213+ # ==== \Numeric objects
214214 #
215- # With integer argument +object+ given, returns +object+:
215+ # With an integer argument +object+ given, returns +object+:
216216 #
217217 # Integer(1) # => 1
218218 # Integer(-1) # => -1
219219 #
220- # With floating-point argument +object+ given,
220+ # With a floating-point argument +object+ given,
221221 # returns +object+ truncated to an integer:
222222 #
223223 # Integer(1.9) # => 1 # Rounds toward zero.
224224 # Integer(-1.9) # => -1 # Rounds toward zero.
225225 #
226- # ==== string objects
226+ # ==== \String objects
227227 #
228- # With string argument +object+ and zero +base+ given,
228+ # With a string argument +object+ and zero +base+ given,
229229 # returns +object+ converted to an integer in base 10:
230230 #
231231 # Integer('100') # => 100
@@ -235,7 +235,7 @@ def Float(arg, exception: true)
235235 # to specify the actual base (radix indicator):
236236 #
237237 # Integer('0100') # => 64 # Leading '0' specifies base 8.
238- # Integer('0b100') # => 4 # Leading '0b', specifies base 2.
238+ # Integer('0b100') # => 4 # Leading '0b' specifies base 2.
239239 # Integer('0x100') # => 256 # Leading '0x' specifies base 16.
240240 #
241241 # With a positive +base+ (in range 2..36) given, returns +object+
@@ -246,8 +246,8 @@ def Float(arg, exception: true)
246246 # Integer('-100', 16) # => -256
247247 #
248248 # With a negative +base+ (in range -36..-2) given, returns +object+
249- # converted to an integer in the radix indicator if exists or
250- # +- base+:
249+ # converted to the radix indicator if it exists or
250+ # +base+:
251251 #
252252 # Integer('0x100', -2) # => 256
253253 # Integer('100', -2) # => 4
@@ -256,42 +256,42 @@ def Float(arg, exception: true)
256256 # Integer('0o100', -10) # => 64
257257 # Integer('100', -10) # => 100
258258 #
259- # +base+ -1 is equal the -10 case.
259+ # +base+ -1 is equivalent to the -10 case.
260260 #
261261 # When converting strings, surrounding whitespace and embedded underscores
262262 # are allowed and ignored:
263263 #
264264 # Integer(' 100 ') # => 100
265265 # Integer('-1_0_0', 16) # => -256
266266 #
267- # ==== other classes
267+ # ==== Other classes
268268 #
269269 # Examples with +object+ of various other classes:
270270 #
271271 # Integer(Rational(9, 10)) # => 0 # Rounds toward zero.
272272 # Integer(Complex(2, 0)) # => 2 # Imaginary part must be zero.
273273 # Integer(Time.now) # => 1650974042
274274 #
275- # ==== keywords
275+ # ==== Keywords
276276 #
277- # With optional keyword argument +exception+ given as +true+ (the default):
277+ # With the optional keyword argument +exception+ given as +true+ (the default):
278278 #
279279 # - Raises TypeError if +object+ does not respond to +to_int+ or +to_i+.
280280 # - Raises TypeError if +object+ is +nil+.
281- # - Raise ArgumentError if +object+ is an invalid string.
281+ # - Raises ArgumentError if +object+ is an invalid string.
282282 #
283283 # With +exception+ given as +false+, an exception of any kind is suppressed
284284 # and +nil+ is returned.
285-
285+ #
286286 def Integer ( arg , base = 0 , exception : true )
287287 if Primitive . mandatory_only?
288288 Primitive . rb_f_integer1 ( arg )
289289 else
290- Primitive . rb_f_integer ( arg , base , exception ) ;
290+ Primitive . rb_f_integer ( arg , base , exception )
291291 end
292292 end
293293
294- # Internal helper for builtin inits to define methods only when YJIT is enabled.
294+ # Internal helper for built-in initializations to define methods only when YJIT is enabled.
295295 # This method is removed in yjit_hook.rb.
296296 def with_yjit ( &block ) # :nodoc:
297297 if defined? ( RubyVM ::YJIT )
0 commit comments