Class: Map::Tube::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/map/tube/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_stationObject

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_stationObject

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_stationsObject

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

#prettyObject



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