Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb
Instance Method Summary collapse
- #*(other) ⇒ Object
- #+(other) ⇒ Object
- #-(other) ⇒ Object
- #/(other) ⇒ Object
- #old_div ⇒ Object
- #old_minus ⇒ Object
- #old_plus ⇒ Object
- #old_times ⇒ Object
Instance Method Details
#*(other) ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 209 def *(other) if other.is_a?(Pulo::Quantity) other*self else self.old_times(other) end end |
#+(other) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 140 def +(other) if other.is_a?(Pulo::Dimensionless) Pulo::Dimensionless.new(self+other.to_base_unit.value) else self.old_plus(other) end end |
#-(other) ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 107 def -(other) if other.is_a?(Pulo::Dimensionless) Pulo::Dimensionless.new(self-other.to_base_unit.value) else self.old_minus(other) end end |
#/(other) ⇒ Object
174 175 176 177 178 179 180 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 174 def /(other) if other.is_a?(Pulo::Quantity) other.inverse*self else self.old_div(other) end end |
#old_div ⇒ Object
173 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 173 alias :old_div :/ |
#old_minus ⇒ Object
106 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 106 alias :old_minus :- |
#old_plus ⇒ Object
139 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 139 alias :old_plus :+ |
#old_times ⇒ Object
208 |
# File 'lib/pulo/quantity/numeric_overloads.rb', line 208 alias :old_times :* |