Class: SFBATransitAPI::Route
- Inherits:
-
Object
- Object
- SFBATransitAPI::Route
- Defined in:
- lib/sfba_transit_api/route.rb
Instance Attribute Summary collapse
-
#agency ⇒ Object
Returns the value of attribute agency.
-
#code ⇒ Object
Returns the value of attribute code.
-
#directions ⇒ Object
Returns the value of attribute directions.
-
#name ⇒ Object
Returns the value of attribute name.
-
#stops ⇒ Object
Returns the value of attribute stops.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#agency ⇒ Object
Returns the value of attribute agency.
3 4 5 |
# File 'lib/sfba_transit_api/route.rb', line 3 def agency @agency end |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/sfba_transit_api/route.rb', line 3 def code @code end |
#directions ⇒ Object
Returns the value of attribute directions.
3 4 5 |
# File 'lib/sfba_transit_api/route.rb', line 3 def directions @directions end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/sfba_transit_api/route.rb', line 3 def name @name end |
#stops ⇒ Object
Returns the value of attribute stops.
3 4 5 |
# File 'lib/sfba_transit_api/route.rb', line 3 def stops @stops end |
Class Method Details
.parse(agency_node, agency) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sfba_transit_api/route.rb', line 13 def self.parse(agency_node, agency) agency_node.xpath(".//Route").map do |route_node| route = new route.agency = agency route.name = route_node["Name"] route.code = route_node["Code"] route.directions = Direction.parse(route_node, route) route.stops = Stop.parse(route_node, route) route end end |
Instance Method Details
#has_direction ⇒ Object
5 6 7 |
# File 'lib/sfba_transit_api/route.rb', line 5 def has_direction directions.count > 0 end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/sfba_transit_api/route.rb', line 9 def to_s "#<SFBATransitAPI::Route:#{object_id} @name=\"#{name}\", @code=\"#{code}\", @direction_codes=\"#{direction_codes}\", @agency=<SFBATransitAPI::Agency:#{agency.object_id}>, directions.count=#{directions.count}, stops.count=#{stops.count}>" end |