diff --git a/numeric.rb b/numeric.rb index 571f9b6314..6b784a877e 100644 --- a/numeric.rb +++ b/numeric.rb @@ -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