Add a comment about Integer#downto Enumerator

This commit is contained in:
Takashi Kokubun 2024-11-13 11:46:29 -08:00
parent 01db456196
commit 907146973a
Notes: git 2024-11-13 20:27:43 +00:00

View File

@ -329,6 +329,8 @@ class Integer
def downto(to) # :nodoc:
Primitive.attr! :inline_block, :c_trace
# When no block is given, return an Enumerator that enumerates from `self` to `to`.
# Not using `block_defined?` and `to_enum` to keep them unaffected by redefinitions.
unless defined?(yield)
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 1, &to, int_downto_size)'
end