Method: Quantify::Unit::Compound#equivalent_known_unit
- Defined in:
- lib/quantify/unit/compound_unit.rb
#equivalent_known_unit ⇒ Object
Return a known unit which is equivalent to self in terms of its physical quantity (dimensions), factor and scaling attributes (i.e. representing the precise same physical unit but perhaps with different identifiers), e.g.
((Unit.kg*(Unit.m**"))/(Unit.s**2)).equivalent_known_unit.name
#=> "joule"
111 112 113 114 115 |
# File 'lib/quantify/unit/compound_unit.rb', line 111 def equivalent_known_unit Unit.units.find do |unit| self.is_equivalent_to?(unit) && !unit.is_compound_unit? end end |