Module: SY::CelsiusMagnitude

Instance Method Summary collapse

Instance Method Details

#+(m2) ⇒ Object

Raises:



161
162
163
164
165
166
167
168
169
# File 'lib/sy.rb', line 161

def + m2
  puts "CelsiusMagnitude#+ method with #{m2}"   # FIXME: This message doesn't show.
  return magnitude amount + m2.amount if
    m2.quantity == SY::Temperature ||
      m2.quantity.colleague == SY::Temperature
  raise QuantityError, "Addition of Celsius temepratures is ambiguous!" if
    m2.quantity == SY::CelsiusTemperature
  super
end

#-(m2) ⇒ Object



171
172
173
174
175
176
177
178
# File 'lib/sy.rb', line 171

def - m2
  puts "CelsiusMagnitude#- method with #{m2}"   # FIXME: This message doesn't show.
  return magnitude amount - m2.amount if
    m2.quantity == SY::Temperature ||
      m2.quantity.colleague == SY::Temperature
  return super.( SY::Temperature ) if m2.quantity == SY::CelsiusTemperature
  super
end