class TaskJuggler::Shift

A shift is a definition of working hours for each day of the week. It may also contain a list of intervals that define off-duty periods or leaves.

Public Class Methods

new(project, id, name, parent) click to toggle source
Calls superclass method TaskJuggler::PropertyTreeNode::new
# File lib/taskjuggler/Shift.rb, line 23
def initialize(project, id, name, parent)
  super(project.shifts, id, name, parent)
  project.addShift(self)

  @data = Array.new(@project.scenarioCount, nil)
  @project.scenarioCount.times do |i|
    ShiftScenario.new(self, i, @scenarioAttributes[i])
  end
end

Public Instance Methods

method_missing(func, scenarioIdx = 0, *args) click to toggle source

Many Shift functions are scenario specific. These functions are provided by the class ShiftScenario. In case we can’t find a function called for the Shift class we try to find it in ShiftScenario.

# File lib/taskjuggler/Shift.rb, line 37
def method_missing(func, scenarioIdx = 0, *args)
  @data[scenarioIdx].method(func).call(*args)
end
scenario(scenarioIdx) click to toggle source

Return a reference to the scenarioIdx-th scenario.

# File lib/taskjuggler/Shift.rb, line 42
def scenario(scenarioIdx)
  return @data[scenarioIdx]
end