Class TaskJuggler::Leave
In: lib/taskjuggler/LeaveList.rb
Parent: Object

This class describes a leave.

Methods

new   to_s   typeIdx  

Constants

Types = { :project => 1, :annual => 2, :special => 3, :sick => 4, :unpaid => 5, :holiday => 6   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

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.

[Source]

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

[Source]

# File lib/taskjuggler/LeaveList.rb, line 51
    def to_s
      "#{@type} #{@reason ? "\"#{@reason}\"" : ""} #{@interval}"
    end

[Source]

# File lib/taskjuggler/LeaveList.rb, line 47
    def typeIdx
      Types[@type]
    end

[Validate]