Class: TaskJuggler::Leave
Overview
This class describes a leave.
Constant Summary collapse
- 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.
{ :project => 1, :annual => 2, :special => 3, :sick => 4, :unpaid => 5, :holiday => 6, :unemployed => 7 }
Instance Attribute Summary collapse
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, interval, reason = nil) ⇒ Leave
constructor
Create a new Leave object.
- #to_s ⇒ Object
- #typeIdx ⇒ Object
Constructor Details
#initialize(type, interval, reason = nil) ⇒ Leave
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.
39 40 41 42 43 44 45 46 |
# 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 |
Instance Attribute Details
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
19 20 21 |
# File 'lib/taskjuggler/LeaveList.rb', line 19 def interval @interval end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
19 20 21 |
# File 'lib/taskjuggler/LeaveList.rb', line 19 def reason @reason end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
19 20 21 |
# File 'lib/taskjuggler/LeaveList.rb', line 19 def type @type end |