Class TaskJuggler::ShiftAssignment
In: lib/taskjuggler/ShiftAssignments.rb
Parent: Object

A ShiftAssignment associate a specific defined shift with a time interval where the shift should be active.

Methods

assigned?   copy   hashKey   new   onLeave?   onShift?   overlaps?   replace?   to_s  

Attributes

interval  [RW] 
shiftScenario  [R] 

Public Class methods

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 26
    def initialize(shiftScenario, interval)
      @shiftScenario = shiftScenario
      @interval = interval
    end

Public Instance methods

Check if date is withing the assignment period.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 52
    def assigned?(date)
      @interval.start <= date && date < @interval.end
    end

Return a deep copy of self.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 36
    def copy
      ShiftAssignment.new(@shiftScenario, TimeInterval.new(@interval))
    end

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 31
    def hashKey
      return "#{@shiftScenario.object_id}|#{@interval.start}|#{@interval.end}"
    end

Returns true if the shift has a leave defined for the date.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 62
    def onLeave?(date)
      @shiftScenario.onLeave?(date)
    end

Returns true if the shift has working hours defined for the date.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 57
    def onShift?(date)
      @shiftScenario.onShift?(date)
    end

Return true if the iv interval overlaps with the assignment interval.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 41
    def overlaps?(iv)
      @interval.overlaps?(iv)
    end

Returns true if the shift is active and requests to replace global leave settings.

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 47
    def replace?(date)
      @interval.start <= date && date < @interval.end && @shiftScenario.replace?
    end

Primarily used for debugging

[Source]

# File lib/taskjuggler/ShiftAssignments.rb, line 67
    def to_s
      "#{@shiftScenario.property.id} #{interval}"
    end

[Validate]