Class: NJTransit::GTFS::Queries::Schedule
- Inherits:
-
Object
- Object
- NJTransit::GTFS::Queries::Schedule
- Defined in:
- lib/njtransit/gtfs/queries/schedule.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(db, route:, stop:, date:) ⇒ Schedule
constructor
A new instance of Schedule.
Constructor Details
#initialize(db, route:, stop:, date:) ⇒ Schedule
Returns a new instance of Schedule.
9 10 11 12 13 14 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 9 def initialize(db, route:, stop:, date:) @db = db @route = route @stop = stop @date = date end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 7 def date @date end |
#db ⇒ Object (readonly)
Returns the value of attribute db.
7 8 9 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 7 def db @db end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
7 8 9 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 7 def route @route end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
7 8 9 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 7 def stop @stop end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/njtransit/gtfs/queries/schedule.rb', line 16 def call route_id = resolve_route_id stop_id = resolve_stop_id service_ids = active_service_ids return [] if route_id.nil? || stop_id.nil? || service_ids.empty? trip_ids = find_trip_ids(route_id, service_ids) return [] if trip_ids.empty? fetch_stop_times(trip_ids, stop_id) end |