Class: Ratis::Route
- Inherits:
-
Object
- Object
- Ratis::Route
- Defined in:
- lib/ratis/route.rb
Instance Attribute Summary collapse
-
#directions ⇒ Object
Returns the value of attribute directions.
-
#short_name ⇒ Object
Returns the value of attribute short_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(short_name, directions) ⇒ Route
constructor
A new instance of Route.
- #timetable(conditions) ⇒ Object
Constructor Details
#initialize(short_name, directions) ⇒ Route
Returns a new instance of Route.
21 22 23 24 |
# File 'lib/ratis/route.rb', line 21 def initialize(short_name, directions) self.short_name = short_name self.directions = directions end |
Instance Attribute Details
#directions ⇒ Object
Returns the value of attribute directions.
5 6 7 |
# File 'lib/ratis/route.rb', line 5 def directions @directions end |
#short_name ⇒ Object
Returns the value of attribute short_name.
5 6 7 |
# File 'lib/ratis/route.rb', line 5 def short_name @short_name end |
Class Method Details
.all ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ratis/route.rb', line 7 def self.all response = Request.get 'Allroutes' return [] unless response.success? routes = response.to_hash[:allroutes_response][:routes].split(/\n/) atis_routes = routes.map do |r| r.strip! next if r.blank? r = r.split(/,/) Route.new r[0].strip, r[1..-1].map(&:strip) end atis_routes.compact end |