Class: TaskJuggler::ShiftScenario

Inherits:
ScenarioData show all
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

#property

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


26
27
28
# File 'lib/taskjuggler/ShiftScenario.rb', line 26

def onShift?(date)
  a('workinghours').onShift?(date)
end

#replace?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/taskjuggler/ShiftScenario.rb', line 30

def replace?
  a('replace')
end