Class: RailwayJp::Station
- Inherits:
-
Object
- Object
- RailwayJp::Station
- Includes:
- Equality
- Defined in:
- lib/railway_jp/station.rb
Constant Summary collapse
- MAPPINGS =
{ id: 'station_cd', name: 'station_name', line_id: 'line_cd', prefecture_id: 'pref_cd', postcode: 'post', address: 'address', longitude: 'lon', latitude: 'lat', }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(row) ⇒ Station
constructor
A new instance of Station.
- #line ⇒ Object
- #line_name ⇒ Object
Methods included from Equality
Constructor Details
Class Method Details
.all ⇒ Object
19 20 21 |
# File 'lib/railway_jp/station.rb', line 19 def all @all ||= data.map { |row| new(row) } end |
.find(id) ⇒ Object
23 24 25 26 |
# File 'lib/railway_jp/station.rb', line 23 def find(id) row = data_index_by_id[id.to_s] row ? new(row) : nil end |