Class: AIXM::Component::Timetable
- Inherits:
-
AIXM::Component
- Object
- AIXM::Component
- AIXM::Component::Timetable
- Defined in:
- lib/aixm/component/timetable.rb
Overview
Timetables define activity time windows.
Cheat Sheat in Pseudo Code:
timetable = AIXM.timetable(
code: String or Symbol (default: :timesheet)
)
timetable.add_timesheet(AIXM.timesheet)
timetable.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 =
{ TIMSH: :timesheet, # attached timesheet 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 ⇒ Object
Timetable code.
Attributes included from AIXM::Concerns::Remarks
Attributes inherited from AIXM::Component
Instance Method Summary collapse
- #add_timesheet(timesheet) ⇒ Object
-
#initialize(code: :timesheet) ⇒ Timetable
constructor
See the cheat sheet for examples on how to create instances of this class.
- #inspect ⇒ String
-
#timesheets ⇒ Array<AIXM::Component::Timesheet>
Timesheets attached to this timetable.
Methods included from AIXM::Concerns::Association
Methods included from AIXM::Concerns::HashEquality
Methods included from AIXM::Concerns::XMLBuilder
#build_fragment, #to_uid, #to_xml
Methods included from AIXM::Concerns::Memoize
Constructor Details
#initialize(code: :timesheet) ⇒ Timetable
See the cheat sheet for examples on how to create instances of this class.
47 48 49 |
# File 'lib/aixm/component/timetable.rb', line 47 def initialize(code: :timesheet) self.code = code end |
Instance Attribute Details
#code ⇒ Symbol #code=(value) ⇒ Object
Timetable code
63 64 65 |
# File 'lib/aixm/component/timetable.rb', line 63 def code timesheets.any? ? :timesheet : @code end |
Instance Method Details
#add_timesheet(timesheet) ⇒ Object
Note:
The #code is forced to :timesheet
once at least one timesheet has been added.
43 |
# File 'lib/aixm/component/timetable.rb', line 43 has_many :timesheets |
#inspect ⇒ String
52 53 54 |
# File 'lib/aixm/component/timetable.rb', line 52 def inspect %Q(#<#{self.class} code=#{code.inspect}>) end |
#timesheets ⇒ Array<AIXM::Component::Timesheet>
Returns timesheets attached to this timetable.
43 |
# File 'lib/aixm/component/timetable.rb', line 43 has_many :timesheets |