class TaskJuggler::ShiftAssignment
A ShiftAssignment
associate a specific defined shift with a time interval where the shift should be active.
Attributes
Public Class Methods
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 27 def initialize(shiftScenario, interval) @shiftScenario = shiftScenario @interval = interval end
Public Instance Methods
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 53 def assigned?(date) @interval.start <= date && date < @interval.end end
Check if date is withing the assignment period.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 37 def copy ShiftAssignment.new(@shiftScenario, TimeInterval.new(@interval)) end
Return a deep copy of self.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 32 def hashKey return "#{@shiftScenario.object_id}|#{@interval.start}|#{@interval.end}" end
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 63 def onLeave?(date) @shiftScenario.onLeave?(date) end
Returns true if the shift has a leave defined for the date.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 58 def onShift?(date) @shiftScenario.onShift?(date) end
Returns true if the shift has working hours defined for the date.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 42 def overlaps?(iv) @interval.overlaps?(iv) end
Return true if the iv interval overlaps with the assignment interval.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 48 def replace?(date) @interval.start <= date && date < @interval.end && @shiftScenario.replace? end
Returns true if the shift is active and requests to replace global leave settings.
Source
# File lib/taskjuggler/ShiftAssignments.rb, line 68 def to_s "#{@shiftScenario.property.id} #{interval}" end
Primarily used for debugging