diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-08-22 21:19:34 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-08-22 21:19:34 +0900 |
| commit | fd2f2f28debdbce8c08bd91305ecf8073817dc47 (patch) | |
| tree | 9c5318614b0971f3be01dcc361b351434c2d5213 /mrblib/numeric.rb | |
| parent | 71f2975a5ba93197fac6a08f21d84bc87e31c6ae (diff) | |
| parent | 85f0dd7da0fe41310883d9a65156c429135590f5 (diff) | |
| download | mruby-fd2f2f28debdbce8c08bd91305ecf8073817dc47.tar.gz mruby-fd2f2f28debdbce8c08bd91305ecf8073817dc47.zip | |
Merge pull request #2922 from gkta/refactor-mrubygem-code
Refactor mrubygem code (range.rb, numeric.rb, string.rb, array.rb, enum.rb)
Diffstat (limited to 'mrblib/numeric.rb')
| -rw-r--r-- | mrblib/numeric.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb index cf608b04b..206185e78 100644 --- a/mrblib/numeric.rb +++ b/mrblib/numeric.rb @@ -100,7 +100,7 @@ module Integral # Calls the given block from +self+ to +num+ # incremented by +step+ (default 1). # - def step(num, step=1, &block) + def step(num, step = 1, &block) raise ArgumentError, "step can't be 0" if step == 0 return to_enum(:step, num, step) unless block_given? @@ -165,16 +165,12 @@ class Float # floats should be compatible to integers. def >> other n = self.to_i - other.to_i.times { - n /= 2 - } + other.to_i.times { n /= 2 } n end def << other n = self.to_i - other.to_i.times { - n *= 2 - } + other.to_i.times { n *= 2 } n.to_i end end |
