Class: AIXM::Component::Timetable
- Inherits:
-
Object
- Object
- AIXM::Component::Timetable
- Defined in:
- lib/aixm/component/timetable.rb
Overview
Note:
As of now, only predefined timetables (see CODES) are imlemented.
Timetables define activity time windows.
Cheat Sheat in Pseudo Code:
= AIXM.(
code: String or Symbol
)
.remarks = String or nil
Shortcuts:
-
AIXM::H24- continuous, all day and all night -
AIXM::H_RE- pattern matching working hour codes
Constant Summary collapse
- CODES =
{ H24: :continuous, # all day and all night HJ: :sunrise_to_sunset, # all day HN: :sunset_to_sunrise, # all night HX: :unspecified, HO: :operational_request, # on request only NOTAM: :notam, # see NOTAM OTHER: :other # specify in remarks }.freeze
Instance Attribute Summary collapse
-
#code ⇒ Symbol
Predefined timetable code (see CODES).
-
#remarks ⇒ String?
Free text remarks.
Instance Method Summary collapse
-
#initialize(code:) ⇒ Timetable
constructor
A new instance of Timetable.
- #inspect ⇒ String
-
#to_xml(as: :Timetable) ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(code:) ⇒ Timetable
Returns a new instance of Timetable.
38 39 40 |
# File 'lib/aixm/component/timetable.rb', line 38 def initialize(code:) self.code = code end |
Instance Attribute Details
#code ⇒ Symbol
Returns predefined timetable code (see CODES).
33 34 35 |
# File 'lib/aixm/component/timetable.rb', line 33 def code @code end |
#remarks ⇒ String?
Returns free text remarks.
36 37 38 |
# File 'lib/aixm/component/timetable.rb', line 36 def remarks @remarks end |
Instance Method Details
#inspect ⇒ String
43 44 45 |
# File 'lib/aixm/component/timetable.rb', line 43 def inspect %Q(#<#{self.class} code=#{code.inspect}>) end |
#to_xml(as: :Timetable) ⇒ String
Returns AIXM or OFMX markup.
56 57 58 59 60 61 62 |
# File 'lib/aixm/component/timetable.rb', line 56 def to_xml(as: :Timetable) builder = Builder::XmlMarkup.new(indent: 2) builder.tag!(as) do |tag| tag.codeWorkHr(CODES.key(code).to_s) tag.txtRmkWorkHr(remarks) if remarks end end |