Class TaskJuggler::LeaveAllowanceList
In: lib/taskjuggler/LeaveList.rb
Parent: Array

The LeaveAllowanceList can store lists of LeaveAllowance objects. Allowances are counted in time slots and can be negative to substract expired allowances.

Methods

balance   new  

Public Class methods

Create a new empty LeaveAllowanceList.

[Source]

# File lib/taskjuggler/LeaveList.rb, line 83
    def initialize(*args)
      super(*args)
    end

Public Instance methods

[Source]

# File lib/taskjuggler/LeaveList.rb, line 87
    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

[Validate]