Class: TaskJuggler::LeaveAllowanceList
- Defined in:
- lib/taskjuggler/LeaveList.rb
Overview
The LeaveAllowanceList can store lists of LeaveAllowance objects. Allowances are counted in time slots and can be negative to substract expired allowances.
Instance Method Summary collapse
- #balance(type, startDate, endDate) ⇒ Object
-
#initialize(*args) ⇒ LeaveAllowanceList
constructor
Create a new empty LeaveAllowanceList.
Constructor Details
#initialize(*args) ⇒ LeaveAllowanceList
Create a new empty LeaveAllowanceList.
84 85 86 |
# File 'lib/taskjuggler/LeaveList.rb', line 84 def initialize(*args) super(*args) end |
Instance Method Details
#balance(type, startDate, endDate) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/taskjuggler/LeaveList.rb', line 88 def balance(type, startDate, endDate) unless Leave::Types[type] raise ArgumentError, "Unsupported leave type #{type}" end balance = 0.0 each do |al| balance += al.slots if al.type == type && al.date >= startDate && al.date < endDate end balance end |