Class: Overtimer::Workweek

Inherits:
Workbase show all
Defined in:
lib/overtimer/workweek.rb

Instance Attribute Summary

Attributes inherited from Workbase

#doubletime, #overtime, #regular, #total

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Workbase

#account_for_hours, #max_overtime, #max_regular

Constructor Details

#initialize(days) ⇒ Workweek

Returns a new instance of Workweek.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/overtimer/workweek.rb', line 22

def initialize days
  super
  @days = days.map!{|i| Workday.new(i) }

  if defined? ALEX_DOUBLE_TIME
    if days.reject{|i| i.total == 0}.size == 7
      @total += @doubletime += days.pop.total
    end
  end

  days.each do |day|
     day.total
    self.doubletime += day.doubletime
    self.overtime -= day.doubletime
  end
end

Class Method Details

.max_regularObject



18
19
20
# File 'lib/overtimer/workweek.rb', line 18

def self.max_regular
  40
end

Instance Method Details

#[](index) ⇒ Object



39
40
41
# File 'lib/overtimer/workweek.rb', line 39

def [] index
  @days[index]
end