Module: Iata
- Extended by:
- SingleForwardable
- Defined in:
- lib/iata.rb,
lib/iata/data.rb,
lib/iata/entry.rb,
lib/iata/loader.rb,
lib/iata/version.rb,
lib/iata/registry.rb,
lib/iata/coordinates.rb,
lib/iata/data/fetcher.rb
Overview
Vendored IATA airport code list as a queryable Ruby registry.
The data is sourced from Wikidata (property P238, "IATA airport code") and ships inside the gem as a small JSON file so the registry works offline. All entries are loaded lazily on first call to Iata.registry.
Defined Under Namespace
Modules: Data Classes: Coordinates, Entry, Loader, Registry
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
-
.registry ⇒ Iata::Registry
The process-wide registry, loaded lazily.
-
.reset_registry! ⇒ Object
Reset the process-wide registry.
-
.source_timestamp ⇒ String?
The Wikidata query timestamp bundled with this gem version (UTC ISO8601).
Class Method Details
.registry ⇒ Iata::Registry
Returns the process-wide registry, loaded lazily.
19 20 21 |
# File 'lib/iata.rb', line 19 def registry @registry ||= Registry.load_default end |
.reset_registry! ⇒ Object
Reset the process-wide registry. Used by specs to swap fixtures.
24 25 26 |
# File 'lib/iata.rb', line 24 def reset_registry! @registry = nil end |
.source_timestamp ⇒ String?
The Wikidata query timestamp bundled with this gem version (UTC ISO8601). nil if the data file lacks this metadata.
31 32 33 |
# File 'lib/iata.rb', line 31 def @source_timestamp ||= registry.entries.first&. end |