class JapanETC::DatabaseProvider::PastDatabase

www.nagoya-expressway.or.jp/etc/etc-lane.html

Public Instance Methods

create_tollbooth_from_row(row) click to toggle source
# File lib/japan_etc/database_provider/past_database.rb, line 22
def create_tollbooth_from_row(row)
  identifier = Tollbooth::Identifier.from(row[0])

  road = Road.new(row[1], row[2])

  Tollbooth.new(
    identifier: identifier,
    road: road,
    name: row[3],
    direction: row[4],
    entrance_or_exit: row[5],
    note: row[6],
    source: source_id,
    priority: -1
  )
end
csv() click to toggle source
# File lib/japan_etc/database_provider/past_database.rb, line 43
def csv
  path = File.join(__dir__, 'past_database.csv')
  File.read(path)
end
fetch_tollbooths() click to toggle source
# File lib/japan_etc/database_provider/past_database.rb, line 16
def fetch_tollbooths
  rows.map do |row|
    create_tollbooth_from_row(row)
  end
end
rows() click to toggle source
# File lib/japan_etc/database_provider/past_database.rb, line 39
def rows
  CSV.parse(csv, headers: :first_row)
end
source_id() click to toggle source
# File lib/japan_etc/database_provider/past_database.rb, line 12
def source_id
  'PastDatabase'
end