summaryrefslogtreecommitdiffhomepage
path: root/mrblib/numeric.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrblib/numeric.rb')
-rw-r--r--mrblib/numeric.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb
index b695e946b..034019e8b 100644
--- a/mrblib/numeric.rb
+++ b/mrblib/numeric.rb
@@ -67,10 +67,12 @@ module Integral
# Calls the given block +self+ times.
#
# ISO 15.2.8.3.22
- def times(&block)
+ def times &block
+ return to_enum :times unless block_given?
+
i = 0
- while(i < self)
- block.call(i)
+ while i < self
+ block.call i
i += 1
end
self