class AIXM::Feature::Address
Address
or similar means to contact an entity.
Cheat Sheet in Pseudo Code:¶ ↑
address = AIXM.address( source: String or nil type: TYPES address: String ) service.remarks = String or nil
@see gitlab.com/openflightmaps/ofmx/wikis/Airport#aha-airport-address
Constants
- TYPES
Attributes
address[R]
@return [String] postal address, phone number, radio frequency etc
remarks[R]
@return [String, nil] free text remarks
type[R]
@return [Symbol] type of address (see {TYPES})
Public Class Methods
new(source: nil, region: nil)
click to toggle source
# File lib/aixm/feature.rb 15 def initialize(source: nil, region: nil) 16 self.source = source 17 self.region = region || AIXM.config.region 18 end
new(source: nil, region: nil, type:, address:)
click to toggle source
Calls superclass method
AIXM::Feature::new
# File lib/aixm/feature/address.rb 52 def initialize(source: nil, region: nil, type:, address:) 53 super(source: source, region: region) 54 self.type, self.address = type, address 55 end
Public Instance Methods
address=(value)
click to toggle source
# File lib/aixm/feature/address.rb 66 def address=(value) 67 fail(ArgumentError, "invalid address") unless value.is_a? String 68 @address = value&.to_s 69 end
inspect()
click to toggle source
@return [String]
# File lib/aixm/feature/address.rb 58 def inspect 59 %Q(#<#{self.class} type=#{type.inspect}>) 60 end
remarks=(value)
click to toggle source
# File lib/aixm/feature/address.rb 71 def remarks=(value) 72 @remarks = value&.to_s 73 end
to_uid(as:, sequence:)
click to toggle source
@return [String] UID markup
# File lib/aixm/feature/address.rb 76 def to_uid(as:, sequence:) 77 builder = Builder::XmlMarkup.new(indent: 2) 78 builder.tag!(as) do |tag| 79 tag << addressable.to_uid.indent(2) if addressable 80 tag.codeType(TYPES.key(type).to_s.then_if(AIXM.aixm?) { _1.sub(/-\w+$/, '') }) 81 tag.noSeq(sequence) 82 end 83 end
to_xml(as:, sequence:)
click to toggle source
@return [String] AIXM
or OFMX markup
# File lib/aixm/feature/address.rb 87 def to_xml(as:, sequence:) 88 builder = Builder::XmlMarkup.new(indent: 2) 89 builder.comment! ["Address: #{TYPES.key(type)}", addressable&.id].compact.join(' for ') 90 builder.tag!(as, { source: (source if AIXM.ofmx?) }.compact) do |tag| 91 tag << to_uid(as: :"#{as}Uid", sequence: sequence).indent(2) 92 tag.txtAddress(address) 93 tag.txtRmk(remarks) if remarks 94 end 95 end
type=(value)
click to toggle source
# File lib/aixm/feature/address.rb 62 def type=(value) 63 @type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type") 64 end