class TaskJuggler::LeaveAllowanceList
The LeaveAllowanceList
can store lists of LeaveAllowance
objects. Allowances are counted in time slots and can be negative to substract expired allowances.
Public Class Methods
new(*args)
click to toggle source
Create a new empty LeaveAllowanceList
.
Calls superclass method
# File lib/taskjuggler/LeaveList.rb, line 84 def initialize(*args) super(*args) end
Public Instance Methods
balance(type, startDate, endDate)
click to toggle source
# 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