Class: TaskJuggler::ShiftScenario
- Inherits:
-
ScenarioData
- Object
- ScenarioData
- TaskJuggler::ShiftScenario
- Defined in:
- lib/taskjuggler/ShiftScenario.rb
Overview
This class handles the scenario specific features of a Shift object.
Instance Attribute Summary
Attributes inherited from ScenarioData
Instance Method Summary collapse
-
#initialize(resource, scenarioIdx, attributes) ⇒ ShiftScenario
constructor
A new instance of ShiftScenario.
-
#onLeave?(date) ⇒ Boolean
Returns true if the shift has a vacation defined for the date.
-
#onShift?(date) ⇒ Boolean
Returns true if the shift has working time defined for the date.
- #replace? ⇒ Boolean
Methods inherited from ScenarioData
#a, #deep_clone, #error, #info, #warning
Constructor Details
#initialize(resource, scenarioIdx, attributes) ⇒ ShiftScenario
Returns a new instance of ShiftScenario.
22 23 24 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 22 def initialize(resource, scenarioIdx, attributes) super end |
Instance Method Details
#onLeave?(date) ⇒ Boolean
Returns true if the shift has a vacation defined for the date.
36 37 38 39 40 41 42 43 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 36 def onLeave?(date) a('leaves').each do |leave| if leave.interval.contains?(date) return true end end false end |
#onShift?(date) ⇒ Boolean
Returns true if the shift has working time defined for the date.
27 28 29 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 27 def onShift?(date) a('workinghours').onShift?(date) end |
#replace? ⇒ Boolean
31 32 33 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 31 def replace? a('replace') end |