Method: Quantify::Unit::Base#multiply

Defined in:
lib/quantify/unit/base_unit.rb

#multiply(other) ⇒ Object Also known as: times, *

Multiply two units together. This results in the generation of a compound unit.



444
445
446
447
448
449
# File 'lib/quantify/unit/base_unit.rb', line 444

def multiply(other)
  options = []
  self.instance_of?(Unit::Compound) ? options += @base_units : options << self
  other.instance_of?(Unit::Compound) ? options += other.base_units : options << other
  Unit::Compound.new(*options)
end