Class: Overtimer::Workbase
- Inherits:
-
Object
- Object
- Overtimer::Workbase
- Defined in:
- lib/overtimer/workbase.rb
Instance Attribute Summary collapse
-
#doubletime ⇒ Object
Returns the value of attribute doubletime.
-
#overtime ⇒ Object
Returns the value of attribute overtime.
-
#regular ⇒ Object
Returns the value of attribute regular.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #account_for_hours(hours) ⇒ Object
-
#initialize(*args) ⇒ Workbase
constructor
A new instance of Workbase.
- #max_overtime ⇒ Object
- #max_regular ⇒ Object
Constructor Details
#initialize(*args) ⇒ Workbase
Returns a new instance of Workbase.
17 18 19 20 21 22 |
# File 'lib/overtimer/workbase.rb', line 17 def initialize *args @total = 0 @regular = 0 @overtime = 0 @doubletime = 0 end |
Instance Attribute Details
#doubletime ⇒ Object
Returns the value of attribute doubletime.
4 5 6 |
# File 'lib/overtimer/workbase.rb', line 4 def doubletime @doubletime end |
#overtime ⇒ Object
Returns the value of attribute overtime.
3 4 5 |
# File 'lib/overtimer/workbase.rb', line 3 def overtime @overtime end |
#regular ⇒ Object
Returns the value of attribute regular.
3 4 5 |
# File 'lib/overtimer/workbase.rb', line 3 def regular @regular end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/overtimer/workbase.rb', line 3 def total @total end |
Instance Method Details
#account_for_hours(hours) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/overtimer/workbase.rb', line 42 def account_for_hours hours if @regular <= max_regular self.regular += hours else self.overtime += hours end @total += hours end |
#max_overtime ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/overtimer/workbase.rb', line 9 def max_overtime if self.class.respond_to? :max_overtime self.class.max_overtime else 999 end end |
#max_regular ⇒ Object
5 6 7 |
# File 'lib/overtimer/workbase.rb', line 5 def max_regular self.class.max_regular end |