Class: Translink::Model::Trip
- Inherits:
-
Object
- Object
- Translink::Model::Trip
- Includes:
- DataMapper::Resource
- Defined in:
- lib/translink/model/trip.rb
Instance Method Summary collapse
-
#add_stop_time_from_stop_time_page(stop_time_page) ⇒ void
Creates a
Model::StopTime
record and associates it with this trip. - #add_stop_times_from_stop_time_pages(stop_time_pages) ⇒ Object
-
#trip_page!(trip_page) ⇒ void
Sets properties from the given
trip_page
.
Instance Method Details
#add_stop_time_from_stop_time_page(stop_time_page) ⇒ void
This method returns an undefined value.
Creates a Model::StopTime
record and associates it with this trip.
27 28 29 30 31 32 33 |
# File 'lib/translink/model/trip.rb', line 27 def add_stop_time_from_stop_time_page stop_time_page StopTime.new.tap do |stop_time| stop_time.trip = self stop_time.stop_time_page! stop_time_page stop_time.save end end |
#add_stop_times_from_stop_time_pages(stop_time_pages) ⇒ Object
35 36 37 38 39 |
# File 'lib/translink/model/trip.rb', line 35 def add_stop_times_from_stop_time_pages stop_time_pages stop_time_pages.map do |stop_time_page| add_stop_time_from_stop_time_page stop_time_page end end |
#trip_page!(trip_page) ⇒ void
This method returns an undefined value.
Sets properties from the given trip_page
.
45 46 47 48 49 |
# File 'lib/translink/model/trip.rb', line 45 def trip_page! trip_page self.id = trip_page.trip_id self.direction = trip_page.direction self.headsign = trip_page.headsign end |