8000 Add a comment about Integer#downto Enumerator · ruby/ruby@9071469 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 9071469

Browse files
committed
Add a comment about Integer#downto Enumerator
1 parent 01db456 commit 9071469

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

numeric.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ def denominator
329329
def downto(to) # :nodoc:
330330
Primitive.attr! :inline_block, :c_trace
331331

332+
# When no block is given, return an Enumerator that enumerates from `self` to `to`.
333+
# Not using `block_defined?` and `to_enum` to keep them unaffected by redefinitions.
332334
unless defined?(yield)
333335
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 1, &to, int_downto_size)'
334336
end

0 commit comments

Comments
 (0)
0