class TaskJuggler::Leave

This class describes a leave.

Constants

Types

This Hash defines the supported leave types. It maps the symbol to its index. The index sequence is important when multiple leaves are defined for the same time slot. A subsequent definition with a type with a larger index will override the old leave type.

Attributes

interval[R]
reason[R]
type[R]

Public Class Methods

new(type, interval, reason = nil) click to toggle source

Create a new Leave object. interval should be an Interval describing the leave period. type must be one of the supported leave types (:holiday, :annual, :special, :unpaid, :sick and :project ). The reason is an optional String that describes the leave reason.

# File lib/taskjuggler/LeaveList.rb, line 39
def initialize(type, interval, reason = nil)
  unless Types[type]
    raise ArgumentError, "Unsupported leave type #{type}"
  end
  @type = type
  @interval = interval
  @reason = reason
end

Public Instance Methods

to_s() click to toggle source
# File lib/taskjuggler/LeaveList.rb, line 52
def to_s
  "#{@type} #{@reason ? "\"#{@reason}\"" : ""} #{@interval}"
end
typeIdx() click to toggle source
# File lib/taskjuggler/LeaveList.rb, line 48
def typeIdx
  Types[@type]
end