Class TaskJuggler::WorkingHoursAttribute
In: lib/taskjuggler/Attributes.rb
Parent: AttributeBase

Methods

new   tjpId   to_tjp  

Public Class methods

[Source]

# File lib/taskjuggler/Attributes.rb, line 696
    def initialize(property, type, container)
      super
    end

[Source]

# File lib/taskjuggler/Attributes.rb, line 700
    def WorkingHoursAttribute::tjpId
      'workinghours'
    end

Public Instance methods

[Source]

# File lib/taskjuggler/Attributes.rb, line 704
    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} - " +
                 "#{iv[1] / 3600}:#{iv[1] % 3600 == 0 ? '00' : iv[1] % 3600}"
        end
        str += "\n" if day < 6
      end
      str
    end

[Validate]