diff options
| author | go.kikuta <[email protected]> | 2015-08-20 17:33:16 +0900 |
|---|---|---|
| committer | go.kikuta <[email protected]> | 2015-08-21 14:54:00 +0900 |
| commit | cb870de2b52fad05c8ba0b23893008d0ba77ac3b (patch) | |
| tree | 263800734550d4347b93527d230a2a1065efbcc4 /mrblib | |
| parent | cf588bd5cb094e6ee22d8d45c2005cf0da55d197 (diff) | |
| download | mruby-cb870de2b52fad05c8ba0b23893008d0ba77ac3b.tar.gz mruby-cb870de2b52fad05c8ba0b23893008d0ba77ac3b.zip | |
numeric.rb: refactor code (Avoid using {...} for multi-line blocks, Surrounding space missing in default value assignment)
Diffstat (limited to 'mrblib')
| -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 |
