lib/percentable/percent.rb in percentable-1.0.0 vs lib/percentable/percent.rb in percentable-1.0.1
- old
+ new
@@ -38,12 +38,12 @@
def * other
case other
when Percent
self.class.new(to_f * other.value)
- when Numeric
- self.class.new(value * other)
+ else
+ self.class.new(value * other.to_f)
end
end
[:+, :-, :/].each do |operator|
define_method operator do |other|
@@ -70,10 +70,10 @@
end
def coerce other
case other
when Numeric
- [AppliedPercent.new(self), other]
+ [CoercedPercent.new(self), other]
else
fail TypeError, "#{self.class} can't be coerced into #{other.class}"
end
end
end