diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-07-17 18:58:21 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-07-17 18:58:21 +0900 |
| commit | 8cb37804c16b1506d019081bb5d366b078b0b42a (patch) | |
| tree | f0f296041e9b9e4f496e89cd9ea69c61e37e514a /mrbgems/mruby-range-ext/mrblib | |
| parent | d5939879ccae40ba4623fce05b8f67dd05a465d7 (diff) | |
| download | mruby-8cb37804c16b1506d019081bb5d366b078b0b42a.tar.gz mruby-8cb37804c16b1506d019081bb5d366b078b0b42a.zip | |
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? |
