class TaskJuggler::WorkingHoursAttribute

Public Class Methods

new(property, type, container) click to toggle source
Calls superclass method TaskJuggler::AttributeBase.new
# File lib/taskjuggler/Attributes.rb, line 689
def initialize(property, type, container)
  super
end
tjpId() click to toggle source
# File lib/taskjuggler/Attributes.rb, line 693
def WorkingHoursAttribute::tjpId
  'workinghours'
end

Public Instance Methods

to_tjp() click to toggle source
# File lib/taskjuggler/Attributes.rb, line 697
def to_tjp
  dayNames = %w( sun mon tue wed thu fri sat )
  str = ''
  7.times do |day|
    str += "workinghours #{dayNames[day]} "
    whs = get.getWorkingHours(day)
    if whs.empty?
      str += "off"
      str += "\n" if day < 6
      next
    end
    first = true
    whs.each do |iv|
      if first
        first = false
      else
        str += ', '
      end
      str += "#{iv[0] / 3600}:#{iv[0] % 3600 == 0 ?
                                '00' : (iv[0] % 3600) / 60} - " +
             "#{iv[1] / 3600}:#{iv[1] % 3600 == 0 ?
                                '00' : (iv[1] % 3600) / 60}"
    end
    str += "\n" if day < 6
  end
  str
end