Drop dependency from `mruby-rational` to `mruby-numeric-ext`
MODIFY
mrbgems/mruby-rational/mrbgem.rake
mrbgems/mruby-rational/mrbgem.rake
@@ -4,5 +4,4 @@ MRuby::Gem::Specification.new('mruby-rational') do |spec|
spec.summary = 'Rational class'
spec.add_dependency 'mruby-object-ext', core: 'mruby-object-ext'
- spec.add_dependency 'mruby-numeric-ext', core: 'mruby-numeric-ext'
end

MODIFY
mrbgems/mruby-rational/mrblib/rational.rb
mrbgems/mruby-rational/mrblib/rational.rb
@@ -83,7 +83,7 @@ end
def Rational(numerator = 0, denominator = 1)
a = numerator
b = denominator
- a, b = b, a % b until b.zero?
+ a, b = b, a % b until b == 0
Rational._new(numerator.div(a), denominator.div(a))
end

MODIFY
mrbgems/mruby-rational/test/rational.rb
mrbgems/mruby-rational/test/rational.rb
@@ -100,3 +100,10 @@ assert 'Float#==(Rational), Float#!=(Rational)' do
assert_equal_rational(true, -2.0, Rational(4,-2))
assert_equal_rational(false, 3.3, Rational(13,4))
end
+
+assert 'Rational#negative?' do
+ assert_predicate(Rational(-2,3), :negative?)
+ assert_predicate(Rational(2,-3), :negative?)
+ assert_not_predicate(Rational(2,3), :negative?)
+ assert_not_predicate(Rational(0), :negative?)
+end

Drop dependency from `mruby-rational` to `mruby-numeric-ext`