diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-17 20:42:25 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-07-17 20:42:25 +0900 |
| commit | 47ac318920407aa6ebfb264108a4629c323897ea (patch) | |
| tree | f0f296041e9b9e4f496e89cd9ea69c61e37e514a /mrbgems/mruby-range-ext/mrblib | |
| parent | d5939879ccae40ba4623fce05b8f67dd05a465d7 (diff) | |
| parent | 8cb37804c16b1506d019081bb5d366b078b0b42a (diff) | |
| download | mruby-47ac318920407aa6ebfb264108a4629c323897ea.tar.gz mruby-47ac318920407aa6ebfb264108a4629c323897ea.zip | |
Merge pull request #4584 from shuujii/allow-mruby-range-ext-to-work-with-MRB_WITHOUT_FLOAT
Allow `mruby-range-ext` to work with `MRB_WITHOUT_FLOAT`; ref 2add8641
Diffstat (limited to 'mrbgems/mruby-range-ext/mrblib')
| -rw-r--r-- | mrbgems/mruby-range-ext/mrblib/range.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-range-ext/mrblib/range.rb b/mrbgems/mruby-range-ext/mrblib/range.rb index a149a57dc..7c5787fac 100644 --- a/mrbgems/mruby-range-ext/mrblib/range.rb +++ b/mrbgems/mruby-range-ext/mrblib/range.rb @@ -32,7 +32,7 @@ class Range return super if block # fast path for numerics - if (val.kind_of?(Fixnum) || val.kind_of?(Float)) && (last.kind_of?(Fixnum) || last.kind_of?(Float)) + if val.kind_of?(Numeric) && last.kind_of?(Numeric) raise TypeError if exclude_end? && !last.kind_of?(Fixnum) return nil if val > last return nil if val == last && exclude_end? @@ -52,7 +52,7 @@ class Range return super if block # fast path for numerics - if (val.kind_of?(Fixnum) || val.kind_of?(Float)) && (last.kind_of?(Fixnum) || last.kind_of?(Float)) + if val.kind_of?(Numeric) && last.kind_of?(Numeric) raise TypeError if exclude_end? && !last.kind_of?(Fixnum) return nil if val > last return nil if val == last && exclude_end? |
