lib/danica/base_operations.rb in danica-2.7.1 vs lib/danica/base_operations.rb in danica-2.7.2

- old
+ new

@@ -1,29 +1,34 @@ module Danica module BaseOperations def +(other) - return other + self if other.is_a?(Operator::Addition) - addition(self, other) + formatted_operation other, addition(self, other) end def *(other) - return other * self if other.is_a?(Operator::Multiplication) - multiplication(self, other) + formatted_operation other, multiplication(self, other) end def /(other) - division(self, other) + formatted_operation other, division(self, other) end def -(other) - self + negative(other) + formatted_operation other, (self + negative(other)) end def **(other) - power(self, other) + formatted_operation other, power(self, other) end def -@ negative(self) + end + + private + + def formatted_operation(other, value) + return other.repack(value) if other.is_a?(Danica::Formatted) + value end end end