class Karashi::Station

Public Class Methods

all_tokyo23() click to toggle source

find all Stations in tokyo 23 wards

# File lib/karashi/station.rb, line 6
def all_tokyo23
  data
end
find_by_code(code) click to toggle source
# File lib/karashi/station.rb, line 10
def find_by_code(code)
  data_by_code[code]
end
find_by_name(name) click to toggle source
# File lib/karashi/station.rb, line 14
def find_by_name(name)
  data_by_name[name]
end
new(data) click to toggle source
# File lib/karashi/station.rb, line 39
def initialize(data)
  @data = data
end

Private Class Methods

data() click to toggle source
# File lib/karashi/station.rb, line 34
def data
  @data ||= Karashi::Loader.load_stations["stations"].map{|station_data| new(station_data) }
end
data_by_code() click to toggle source
# File lib/karashi/station.rb, line 20
def data_by_code
  return @data_by_code unless @data_by_code.nil?
  @data_by_code = {}
  data.each{|station| @data_by_code[station.code] = station }
  @data_by_code
end
data_by_name() click to toggle source
# File lib/karashi/station.rb, line 27
def data_by_name
  return @data_by_name unless @data_by_name.nil?
  @data_by_name = {}
  data.each{|station| @data_by_name[station.name] = station }
  @data_by_name
end