Class: CTA::Train
- Inherits:
-
Trip
- Object
- Sequel::Model
- Trip
- CTA::Train
show all
- Defined in:
- lib/cta_redux/models/train.rb
Overview
Note:
Current columns: [:route_id, :service_id, :trip_id, :direction_id, :block_id, :shape_id, :direction, :wheelchair_accessible, :schd_trip_id]
A Sequel::Model, inherited from Trip This corresponds to trips.txt in the GTFS feed, though the CTA does not fully implement the standard.
Defined Under Namespace
Classes: Live, Prediction
Constant Summary
collapse
- L_ROUTES =
{
"red" => { :name => "Red",
:directions => { "1" => "Howard-bound", "5" => "95th/Dan Ryan-bound" }
},
"blue" => { :name => "Blue",
:directions => { "1" => "O'Hare-bound", "5" => "Forest Park-bound" }
},
"brn" => { :name => "Brown",
:directions => { "1" => "Kimball-bound", "5" => "Loop-bound" }
},
"g" => { :name => "Green",
:directions => { "1" => "Harlem/Lake-bound", "5" => "Ashland/63rd- or Cottage Grove-bound (toward 63rd St destinations)" }
},
"org" => { :name => "Orange",
:directions => { "1" => "Loop-bound", "5" => "Midway-bound" }
},
"p" => { :name => "Purple",
:directions => { "1" => "Linden-bound", "5" => "Howard- or Loop-bound" }
},
"pink" => { :name => "Pink",
:directions => { "1" => "Loop-bound", "5" => "54th/Cermak-bound" }
},
"y" => { :name => "Yellow",
:directions => { "1" => "Skokie-bound", "5" => "Howard-bound" }
},
}
- FRIENDLY_L_ROUTES =
Hash[L_ROUTES.values.map { |r| r[:name].downcase.to_sym }.zip(L_ROUTES.keys)]
Constants inherited
from Trip
CTA::Trip::BUS_ROUTES
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Trip
#calendar, find_active_run, #route, #stop_times, #stops
Instance Attribute Details
Returns the Live data associated with this CTA::Train object, if available.
9
10
11
|
# File 'lib/cta_redux/models/train.rb', line 9
def live
@live
end
|
Instance Method Details
#block_id ⇒ Integer
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#direction ⇒ String
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#direction_id ⇒ Integer
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
Follows a train, using the TrainTracker follow API
63
64
65
|
# File 'lib/cta_redux/models/train.rb', line 63
def follow!
CTA::TrainTracker.follow!(:run => self.schd_trip_id.gsub("R", ""))
end
|
#route_id ⇒ String
Also known as:
id
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#schd_trip_id ⇒ String
Also known as:
scheduled_trip_id, run
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#service_id ⇒ Integer
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#shape_id ⇒ Integer
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#trip_id ⇒ Integer
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|
#wheelchair_accessible ⇒ true, false
57
|
# File 'lib/cta_redux/models/train.rb', line 57
alias_method :id, :route_id
|