Sha256: 66cb39cd65256b9a061f270452a88ff4faf97347e2901ca9b8da0608c7ae7f09

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

module GTFS
  class Realtime
    class Trip < GTFS::Realtime::Model
      many_to_one :route
      many_to_many :stops, join_table: :gtfs_realtime_stop_times
      one_to_many :calendar_dates, primary_key: :service_id, key: :service_id
      one_to_many :shapes, primary_key: :shape_id, key: :id

      def active?(date)
        # can't use .where chaining b/c Sequel is weird
        calendar_dates.find{|cd| cd.exception_type == GTFS::Realtime::CalendarDate::ADDED && cd.date == date}
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gtfs-realtime-0.3.0 lib/gtfs/realtime/trip.rb
gtfs-realtime-0.2.3 lib/gtfs/realtime/trip.rb
gtfs-realtime-0.2.2 lib/gtfs/realtime/trip.rb