Class: NJTransit::GTFS::QueryInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/njtransit/gtfs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_path) ⇒ QueryInterface

Returns a new instance of QueryInterface.



89
90
91
92
93
# File 'lib/njtransit/gtfs.rb', line 89

def initialize(db_path)
  Database.connection(db_path)
  @db = Database.connection
  setup_models
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



87
88
89
# File 'lib/njtransit/gtfs.rb', line 87

def db
  @db
end

Instance Method Details

#routesObject



99
100
101
# File 'lib/njtransit/gtfs.rb', line 99

def routes
  Models::Route
end

#routes_between(from:, to:) ⇒ Object



103
104
105
# File 'lib/njtransit/gtfs.rb', line 103

def routes_between(from:, to:)
  Queries::RoutesBetween.new(db, from: from, to: to).call
end

#schedule(route:, stop:, date:) ⇒ Object



107
108
109
# File 'lib/njtransit/gtfs.rb', line 107

def schedule(route:, stop:, date:)
  Queries::Schedule.new(db, route: route, stop: stop, date: date).call
end

#stopsObject



95
96
97
# File 'lib/njtransit/gtfs.rb', line 95

def stops
  Models::Stop
end