Method: NumericWithUnit#coerce

Defined in:
lib/numeric_with_unit.rb

#coerce(other) ⇒ Object



121
122
123
124
125
126
127
# File 'lib/numeric_with_unit.rb', line 121

def coerce(other)
  if other.is_a?(self.class)
    [other, self]
  else
    [self.class.new(other, Unit.new), self]
  end
end