Class: MBTA::HeavyRail::Station
- Inherits:
-
Object
- Object
- MBTA::HeavyRail::Station
- Defined in:
- lib/mbta/heavy_rail/station.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
- #platforms(direction = nil) ⇒ Object
Instance Method Summary collapse
- #[](direction) ⇒ Object
-
#initialize(line, name, platforms = []) ⇒ Station
constructor
A new instance of Station.
- #inspect ⇒ Object
Constructor Details
#initialize(line, name, platforms = []) ⇒ Station
Returns a new instance of Station.
7 8 9 10 11 |
# File 'lib/mbta/heavy_rail/station.rb', line 7 def initialize(line, name, platforms = []) @line = line @name = name @platforms = platforms end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
4 5 6 |
# File 'lib/mbta/heavy_rail/station.rb', line 4 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/mbta/heavy_rail/station.rb', line 4 def name @name end |
#platforms(direction = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/mbta/heavy_rail/station.rb', line 17 def platforms(direction = nil) if (direction) self[direction] else @platforms end end |
Instance Method Details
#[](direction) ⇒ Object
25 26 27 |
# File 'lib/mbta/heavy_rail/station.rb', line 25 def [](direction) @platforms.find { |platform| platform.direction == direction } end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/mbta/heavy_rail/station.rb', line 13 def inspect %("#{@name}") end |