diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-14 02:41:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-14 02:41:22 +0900 |
| commit | 113ab607846e63c0348758d3e13017e0ea3a45a3 (patch) | |
| tree | 379aa985de0a4c1a148bc693b2207eaf66d44bc3 /mrblib/numeric.rb | |
| parent | 463c5f83c3e5f379d4dd59deb17179915fbaf93b (diff) | |
| download | mruby-113ab607846e63c0348758d3e13017e0ea3a45a3.tar.gz mruby-113ab607846e63c0348758d3e13017e0ea3a45a3.zip | |
mruby-enumerator: move definitions in core_mod.rb to mrblib core
Diffstat (limited to 'mrblib/numeric.rb')
| -rw-r--r-- | mrblib/numeric.rb | 8 |
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 |
