From 907146973a7aeb85d1748cb427e87d914d86a3b9 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 13 Nov 2024 11:46:29 -0800 Subject: [PATCH] Add a comment about Integer#downto Enumerator --- numeric.rb | 2 ++ 1 file changed, 2 insertions(+) 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