Method: RubyUnits::Unit#===
- Defined in:
- lib/ruby_units/unit.rb
#===(other) ⇒ Boolean Also known as: same?, same_as?
Compare two units. Returns true if quantities and units match
681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/ruby_units/unit.rb', line 681 def ===(other) case other when Unit (self.scalar == other.scalar) && (self.units == other.units) else begin x, y = coerce(other) return x === y rescue ArgumentError return false end end end |