diff options
| author | Christopher Aue <[email protected]> | 2017-07-30 13:19:31 +0200 |
|---|---|---|
| committer | Christopher Aue <[email protected]> | 2017-07-30 13:19:31 +0200 |
| commit | 3359b86ec7284234ae088ab682f82a0603029c34 (patch) | |
| tree | 0e6e5f5dcb967d3a874a4d4f442bc4147818d98c /mrblib/numeric.rb | |
| parent | c8fdab8725d58375ccdbd9816e48fdb021a199d4 (diff) | |
| download | mruby-3359b86ec7284234ae088ab682f82a0603029c34.tar.gz mruby-3359b86ec7284234ae088ab682f82a0603029c34.zip | |
Improved speed of enumeration methods
Diffstat (limited to 'mrblib/numeric.rb')
| -rw-r--r-- | mrblib/numeric.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb index 975ad973f..89401a084 100644 --- a/mrblib/numeric.rb +++ b/mrblib/numeric.rb @@ -45,7 +45,7 @@ module Integral # # ISO 15.2.8.3.15 def downto(num, &block) - return to_enum(:downto, num) unless block_given? + return to_enum(:downto, num) unless block i = self.to_i while i >= num @@ -70,7 +70,7 @@ module Integral # # ISO 15.2.8.3.22 def times &block - return to_enum :times unless block_given? + return to_enum :times unless block i = 0 while i < self @@ -86,7 +86,7 @@ module Integral # # ISO 15.2.8.3.27 def upto(num, &block) - return to_enum(:upto, num) unless block_given? + return to_enum(:upto, num) unless block i = self.to_i while i <= num @@ -102,7 +102,7 @@ module Integral # def step(num=nil, step=1, &block) raise ArgumentError, "step can't be 0" if step == 0 - return to_enum(:step, num, step) unless block_given? + return to_enum(:step, num, step) unless block i = if num.kind_of? Float then self.to_f else self end if num == nil |
