Very simple base class used to store some common properties and methods for objects which deal with worked hours.
Committed, not committed hours (floats)
Committed, not committed hours (floats)
# File lib/track_record_report.rb, line 21 def initialize reset!() end
Add the given calculator’s committed and not committed hours to this calculator’s hours.
# File lib/track_record_report.rb, line 40 def add!( calculator ) @committed += calculator.committed @not_committed += calculator.not_committed end
Returns ‘true’ if the object records > 0 total hours, else ‘false’.
# File lib/track_record_report.rb, line 33 def has_hours? return ( total() > 0.0 ) end
Reset the object’s hour counts.
# File lib/track_record_report.rb, line 54 def reset! @committed = 0.0 @not_committed = 0.0 end
Opposite of ‘add!’.
# File lib/track_record_report.rb, line 47 def subtract!( calculator ) @committed -= calculator.committed @not_committed -= calculator.not_committed end
Returns total worked hours (committed plus not committed).
# File lib/track_record_report.rb, line 27 def total return ( @committed + @not_committed ) end