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.
21 22 23 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 21 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.
35 36 37 38 39 40 41 42 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 35 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.
26 27 28 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 26 def onShift?(date) a('workinghours').onShift?(date) end |
#replace? ⇒ Boolean
30 31 32 |
# File 'lib/taskjuggler/ShiftScenario.rb', line 30 def replace? a('replace') end |