class GTFS::Realtime::Stop

Public Instance Methods

stop_times_for_today() click to toggle source
# File lib/gtfs/realtime/stop.rb, line 20
def stop_times_for_today
  stop_times = stop_times_schedule_for(Date.today)
  stop_time_updates.each do |stu|
    # find a matching existing record in the schedule
    stop_time = stop_times.find{|st| st.trip_id == stu.trip_update.trip_id}

    # update its info
    stop_time.set(stu)
  end
  stop_times
end
stop_times_schedule_for(date) click to toggle source
# File lib/gtfs/realtime/stop.rb, line 16
def stop_times_schedule_for(date)
  stop_times.includes(trip: [:calendar_dates, :route, :shapes]).select{|st| st.trip.active?(date)}.sort_by{|st| st.departure_time}
end