Class: TaskJuggler::WorkingHoursAttribute
- Inherits:
-
AttributeBase
- Object
- AttributeBase
- TaskJuggler::WorkingHoursAttribute
- Defined in:
- lib/taskjuggler/Attributes.rb
Instance Attribute Summary
Attributes inherited from AttributeBase
#inherited, #property, #provided, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(property, type, container) ⇒ WorkingHoursAttribute
constructor
A new instance of WorkingHoursAttribute.
- #to_tjp ⇒ Object
Methods inherited from AttributeBase
#get, #id, #inherit, isList?, #isList?, mode, #name, #nil?, #reset, #set, setMode, #to_num, #to_rti, #to_s, #to_sort
Constructor Details
#initialize(property, type, container) ⇒ WorkingHoursAttribute
Returns a new instance of WorkingHoursAttribute.
690 691 692 |
# File 'lib/taskjuggler/Attributes.rb', line 690 def initialize(property, type, container) super end |
Class Method Details
.tjpId ⇒ Object
694 695 696 |
# File 'lib/taskjuggler/Attributes.rb', line 694 def WorkingHoursAttribute::tjpId 'workinghours' end |
Instance Method Details
#to_tjp ⇒ Object
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
# File 'lib/taskjuggler/Attributes.rb', line 698 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 |