class BigDecimal

Add and subtract work for Dimensionless

Division (Scalar/Quantity) gives (1/Quantity) * Scalar

Multiplication is a reversal for Quantity * Scalar

Public Instance Methods

*(other) click to toggle source
# File lib/pulo/quantity/numeric_overloads.rb, line 186
def *(other)
  if other.is_a?(Pulo::Quantity)
    other*self
  else
    self.old_times(other)
  end
end
Also aliased as: old_times
+(other) click to toggle source
# File lib/pulo/quantity/numeric_overloads.rb, line 118
def +(other)
  if other.is_a?(Pulo::Dimensionless)
    Pulo::Dimensionless.new(self+other.to_base_unit.value)
  else
    self.old_plus(other)
  end
end
Also aliased as: old_plus
-(other) click to toggle source
# File lib/pulo/quantity/numeric_overloads.rb, line 85
def -(other)
  if other.is_a?(Pulo::Dimensionless)
    Pulo::Dimensionless.new(self-other.to_base_unit.value)
  else
    self.old_minus(other)
  end
end
Also aliased as: old_minus
/(other) click to toggle source
# File lib/pulo/quantity/numeric_overloads.rb, line 152
def /(other)
  if other.is_a?(Pulo::Quantity)
    other.inverse*self
  else
    self.old_div(other)
  end
end
Also aliased as: old_div
old_div(other)
Alias for: /
old_minus(other)
Alias for: -
old_plus(other)
Alias for: +
old_times(other)
Alias for: *