Class: WMATA::PathSegment
- Defined in:
- lib/resources/path_segment.rb
Overview
A resource class representing a segment in a path between two stations.
Available attribute methods:
-
station_code
- The ID code for an individual station. -
station_name
- The name of the Station. -
line_code
- The ID (color) of the Line associated with the path. -
seq_num
- The sequence of the station in the path. -
distance_to_previous
- Distance in feet from the previous station in the path.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#distance_to_previous ⇒ Object
The distance to the previous station in the path.
-
#index ⇒ Object
The position this
PathSegment
is in the overall path. -
#line ⇒ Object
Returns the
Line
instance for the line this segment falls on. -
#station ⇒ Object
Return the
Station
instance representing the station on this segment of the path.
Methods inherited from Resource
endpoint, get_all, #initialize, #method_missing, service, to_query_string
Constructor Details
This class inherits a constructor from WMATA::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class WMATA::Resource
Instance Method Details
#distance_to_previous ⇒ Object
The distance to the previous station in the path.
33 34 35 |
# File 'lib/resources/path_segment.rb', line 33 def distance_to_previous @attrs['DistanceToPrev'] end |
#index ⇒ Object
The position this PathSegment
is in the overall path.
28 29 30 |
# File 'lib/resources/path_segment.rb', line 28 def index @attrs['SeqNum'] end |
#line ⇒ Object
Returns the Line
instance for the line this segment falls on.
23 24 25 |
# File 'lib/resources/path_segment.rb', line 23 def line @line ||= Line.get(@attrs['LineCode']) end |
#station ⇒ Object
Return the Station
instance representing the station on this segment of the path.
18 19 20 |
# File 'lib/resources/path_segment.rb', line 18 def station @station ||= Station.get(@attrs['StationCode']) end |