class TrackRecordReport::Calculator

Basic object containing a committed and not-committed hour count, with some simple related helper methods.

Clients manipulate the committed/not-committed values directly. They’re BigDecimals starting at zero. Higher levels of abstraction cause too great a performance hit.

Attributes

committed[RW]
not_committed[RW]

Public Class Methods

new() click to toggle source
# File lib/track_record_report.rb, line 100
def initialize
  @committed = @not_committed = BigDecimal.new( 0 )
end

Public Instance Methods

has_hours?() click to toggle source

Returns ‘true’ if the object records > 0 total hours, else ‘false’.

# File lib/track_record_report.rb, line 112
def has_hours?
  return ( total() > BigDecimal.new( 0 ) )
end
total() click to toggle source

Returns total worked hours (committed plus not committed).

# File lib/track_record_report.rb, line 106
def total
  return ( @committed + @not_committed )
end