Method: Unit#+

Defined in:
lib/unit/class.rb

#+(other) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/unit/class.rb', line 71

def +(other)
  if Numeric === other
    other = coerce_numeric_compatible(other)
    a, b = self.normalize, other.normalize
    Unit.new(a.value + b.value, b.unit, system).in(self)
  else
    apply_through_coercion(other, __method__)
  end
end