class Kwh
Attributes
value[RW]
Public Class Methods
new(value)
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 10 def initialize(value) self.value = value end
Public Instance Methods
-(other)
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 22 def -(other) kWh(self.value - other.value) end
==(other)
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 14 def ==(other) if other.is_a?(Kwh) return (self - other).value.abs < 0.001 end false end
inspect()
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 26 def inspect "#{value}kWh" end
to_f()
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 34 def to_f value end
to_s()
click to toggle source
# File lib/p1_meter_reader/kwh.rb, line 30 def to_s inspect end