Class: AIXM::Feature::Organisation
- Inherits:
-
AIXM::Feature
- Object
- AIXM::Feature
- AIXM::Feature::Organisation
- Defined in:
- lib/aixm/feature/organisation.rb
Overview
Organisations and authorities such as ATS organisations, aircraft operating agencies, states and so forth.
Cheat Sheet in Pseudo Code:
organisation = AIXM.organisation(
source: String or nil
name: String
type: TYPES
)
organisation.id = String or nil
organisation.remarks = String or nil
Constant Summary collapse
- TYPES =
{ S: :state, GS: :group_of_states, O: :national_organisation, IO: :international_organisation, AOA: :aircraft_operating_agency, ATS: :air_traffic_services_provider, HA: :handling_authority, A: :national_authority, OTHER: :other # specify in remarks }.freeze
Instance Attribute Summary collapse
-
#id ⇒ String?
Code of the organisation (e.g. “LF”).
-
#name ⇒ String
Name of organisation (e.g. “FRANCE”).
-
#remarks ⇒ String?
Free text remarks.
-
#type ⇒ Symbol
Type of organisation (see TYPES).
Attributes inherited from AIXM::Feature
Instance Method Summary collapse
-
#initialize(source: nil, name:, type:) ⇒ Organisation
constructor
A new instance of Organisation.
- #inspect ⇒ String
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Methods inherited from AIXM::Feature
Constructor Details
#initialize(source: nil, name:, type:) ⇒ Organisation
Returns a new instance of Organisation.
46 47 48 49 |
# File 'lib/aixm/feature/organisation.rb', line 46 def initialize(source: nil, name:, type:) super(source: source) self.name, self.type = name, type end |
Instance Attribute Details
#id ⇒ String?
Returns code of the organisation (e.g. “LF”).
41 42 43 |
# File 'lib/aixm/feature/organisation.rb', line 41 def id @id end |
#name ⇒ String
Returns name of organisation (e.g. “FRANCE”).
35 36 37 |
# File 'lib/aixm/feature/organisation.rb', line 35 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
44 45 46 |
# File 'lib/aixm/feature/organisation.rb', line 44 def remarks @remarks end |
#type ⇒ Symbol
Returns type of organisation (see TYPES).
38 39 40 |
# File 'lib/aixm/feature/organisation.rb', line 38 def type @type end |
Instance Method Details
#inspect ⇒ String
52 53 54 |
# File 'lib/aixm/feature/organisation.rb', line 52 def inspect %Q(#<#{self.class} name=#{name.inspect} type=#{type.inspect}>) end |
#to_uid ⇒ String
Returns UID markup.
75 76 77 78 79 80 |
# File 'lib/aixm/feature/organisation.rb', line 75 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.OrgUid do |org_uid| org_uid.txtName(name) end end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/aixm/feature/organisation.rb', line 83 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.comment! "Organisation: #{name}" builder.Org({ source: (source if AIXM.ofmx?) }.compact) do |org| org << to_uid.indent(2) org.codeId(id) if id org.codeType(TYPES.key(type).to_s) org.txtRmk(remarks) if remarks end end |