diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-20 16:35:06 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-21 21:08:26 +0900 |
| commit | b7f85b9df91168f8c6338354bc50a621ca0e098b (patch) | |
| tree | e4f36d399c3bb15e0f54b429de4d8ee0d9a763db /mrbgems | |
| parent | 5d30309e9826fe1a392fa7a7a33e11ad58857b3f (diff) | |
| download | mruby-b7f85b9df91168f8c6338354bc50a621ca0e098b.tar.gz mruby-b7f85b9df91168f8c6338354bc50a621ca0e098b.zip | |
Should not refer `Float` class in case of `MRB_WITHOUT_FLOAT`.
This commit removes `Float` from `rational.c`.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-rational/mrblib/rational.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/mrbgems/mruby-rational/mrblib/rational.rb b/mrbgems/mruby-rational/mrblib/rational.rb index cecede48a..c8614ecea 100644 --- a/mrbgems/mruby-rational/mrblib/rational.rb +++ b/mrbgems/mruby-rational/mrblib/rational.rb @@ -48,12 +48,9 @@ class Rational < Numeric end def <=>(rhs) - case rhs - when Fixnum + if rhs.is_a?(Integral) return numerator <=> rhs if denominator == 1 rhs = Rational(rhs) - when Float - return to_f <=> rhs end case rhs @@ -103,5 +100,5 @@ end end __send__(original_operator_name, rhs) end - end + end if Object.const_defined?(:Float) end |
