Class: Iata::Entry
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Iata::Entry
- Defined in:
- lib/iata/entry.rb
Overview
A single IATA airport entry.
Stores wire-level fields as lutaml-model attributes (so the bundled
JSON can be parsed round-trip) and exposes typed helpers (#coordinates,
#country_name) for ergonomic queries.
Instance Method Summary collapse
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/iata/entry.rb', line 27 def ==(other) other.is_a?(Entry) && code == other.code end |
#coordinates ⇒ Object
21 22 23 24 25 |
# File 'lib/iata/entry.rb', line 21 def coordinates return Coordinates.new(latitude: nil, longitude: nil) if latitude.nil? && longitude.nil? Coordinates.new(latitude: latitude, longitude: longitude) end |
#eql?(other) ⇒ Boolean
35 36 37 |
# File 'lib/iata/entry.rb', line 35 def eql?(other) self == other end |
#hash ⇒ Object
31 32 33 |
# File 'lib/iata/entry.rb', line 31 def hash code&.hash || super end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/iata/entry.rb', line 39 def to_s "#{code} #{name}".strip end |