Class: AIXM::Feature::Organisation
- Inherits:
-
AIXM::Feature
- Object
- AIXM::Feature
- AIXM::Feature::Organisation
- Includes:
- Association, Memoize
- 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
region: 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
Constants inherited from AIXM::Feature
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
- #add_member(member) ⇒ self
-
#initialize(source: nil, region: nil, name:, type:) ⇒ Organisation
constructor
A new instance of Organisation.
- #inspect ⇒ String
-
#members ⇒ Array<AIXM::Feature::Airport, AIXM::Feature::Unit, AIXM::Feature::NavigationalAid>
Aiports, units or navigational aids.
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Methods included from Memoize
Methods included from Association
Methods inherited from AIXM::Feature
Constructor Details
#initialize(source: nil, region: nil, name:, type:) ⇒ Organisation
Returns a new instance of Organisation.
61 62 63 64 |
# File 'lib/aixm/feature/organisation.rb', line 61 def initialize(source: nil, region: nil, name:, type:) super(source: source, region: region) self.name, self.type = name, type end |
Instance Attribute Details
#id ⇒ String?
Returns code of the organisation (e.g. “LF”).
56 57 58 |
# File 'lib/aixm/feature/organisation.rb', line 56 def id @id end |
#name ⇒ String
Returns name of organisation (e.g. “FRANCE”).
50 51 52 |
# File 'lib/aixm/feature/organisation.rb', line 50 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
59 60 61 |
# File 'lib/aixm/feature/organisation.rb', line 59 def remarks @remarks end |
#type ⇒ Symbol
Returns type of organisation (see TYPES).
53 54 55 |
# File 'lib/aixm/feature/organisation.rb', line 53 def type @type end |
Instance Method Details
#add_member(member) ⇒ self
47 |
# File 'lib/aixm/feature/organisation.rb', line 47 has_many :members, accept: [:airport, :unit, 'AIXM::Feature::NavigationalAid'] |
#inspect ⇒ String
67 68 69 |
# File 'lib/aixm/feature/organisation.rb', line 67 def inspect %Q(#<#{self.class} name=#{name.inspect} type=#{type.inspect}>) end |
#members ⇒ Array<AIXM::Feature::Airport, AIXM::Feature::Unit, AIXM::Feature::NavigationalAid>
Returns aiports, units or navigational aids.
47 |
# File 'lib/aixm/feature/organisation.rb', line 47 has_many :members, accept: [:airport, :unit, 'AIXM::Feature::NavigationalAid'] |
#to_uid ⇒ String
Returns UID markup.
90 91 92 93 94 95 |
# File 'lib/aixm/feature/organisation.rb', line 90 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.OrgUid({ region: (region if AIXM.ofmx?) }.compact) do |org_uid| org_uid.txtName(name) end end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/aixm/feature/organisation.rb', line 99 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 |