Class: Translink::Page::Trip::StopTime
- Inherits:
-
Object
- Object
- Translink::Page::Trip::StopTime
- Defined in:
- lib/translink/page/trip.rb
Instance Attribute Summary collapse
-
#arrival_time ⇒ Object
- String
-
The time the vehicle arrives at the
stop
.
-
#stop_page ⇒ Object
- Page::Trip::Stop
-
Stop associated with the
arrival_time
.
-
#stop_sequence ⇒ Object
- Integer
-
Order in which this stop is visited in the trip.
Instance Method Summary collapse
-
#departure_time ⇒ String
Time vehicle starts from the
stop
. -
#html!(node_set) ⇒ Page::Trip::Stop
Sets attributes by extracting attributes from the HTML fragment.
Instance Attribute Details
#arrival_time ⇒ Object
- String
-
The time the vehicle arrives at the
stop
.
34 35 36 |
# File 'lib/translink/page/trip.rb', line 34 def arrival_time @arrival_time end |
#stop_page ⇒ Object
- Page::Trip::Stop
-
Stop associated with the
arrival_time
.
35 36 37 |
# File 'lib/translink/page/trip.rb', line 35 def stop_page @stop_page end |
#stop_sequence ⇒ Object
- Integer
-
Order in which this stop is visited in the trip.
36 37 38 |
# File 'lib/translink/page/trip.rb', line 36 def stop_sequence @stop_sequence end |
Instance Method Details
#departure_time ⇒ String
Time vehicle starts from the stop
. Translink doesn’t provide an explicit departure_time
so we use the arrival_time
.
42 43 44 |
# File 'lib/translink/page/trip.rb', line 42 def departure_time arrival_time end |
#html!(node_set) ⇒ Page::Trip::Stop
Sets attributes by extracting attributes from the HTML fragment.
50 51 52 53 54 |
# File 'lib/translink/page/trip.rb', line 50 def html! node_set @stop_page = Stop.new.html! node_set @arrival_time = node_set.search('td').first.text.sub('.', ':').sub(/(a|p)(m)$/, ' \1.M.').upcase # "12:25pm" -> "12:25 P.M" self end |