Class: RailwayJp::Station
- Inherits:
-
Object
- Object
- RailwayJp::Station
- 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
Constructor Details
Class Method Details
.all ⇒ Object
17 18 19 |
# File 'lib/railway_jp/station.rb', line 17 def all @all ||= data.map { |row| new(row) } end |
.find(id) ⇒ Object
21 22 23 24 |
# File 'lib/railway_jp/station.rb', line 21 def find(id) row = data_index_by_id[id.to_s] row ? new(row) : nil end |