Class: Map::Tube::Route
- Inherits:
-
Object
- Object
- Map::Tube::Route
- Defined in:
- lib/map/tube/route.rb
Instance Attribute Summary collapse
-
#arrival_station ⇒ Object
Returns the value of attribute arrival_station.
-
#departure_station ⇒ Object
Returns the value of attribute departure_station.
-
#intermediate_stations ⇒ Object
Returns the value of attribute intermediate_stations.
Instance Method Summary collapse
-
#initialize(departure_station, arrival_station) ⇒ Route
constructor
A new instance of Route.
- #pretty ⇒ Object
Constructor Details
#initialize(departure_station, arrival_station) ⇒ Route
Returns a new instance of Route.
6 7 8 9 10 |
# File 'lib/map/tube/route.rb', line 6 def initialize(departure_station, arrival_station) @departure_station = departure_station @arrival_station = arrival_station @intermediate_stations = [] end |
Instance Attribute Details
#arrival_station ⇒ Object
Returns the value of attribute arrival_station.
4 5 6 |
# File 'lib/map/tube/route.rb', line 4 def arrival_station @arrival_station end |
#departure_station ⇒ Object
Returns the value of attribute departure_station.
4 5 6 |
# File 'lib/map/tube/route.rb', line 4 def departure_station @departure_station end |
#intermediate_stations ⇒ Object
Returns the value of attribute intermediate_stations.
4 5 6 |
# File 'lib/map/tube/route.rb', line 4 def intermediate_stations @intermediate_stations end |
Instance Method Details
#pretty ⇒ Object
12 13 14 15 16 |
# File 'lib/map/tube/route.rb', line 12 def pretty [self.departure_station.name, self.intermediate_stations.map(&:name), self.arrival_station.name].flatten.join(" -> ") end |