Class: MBTA::HeavyRail::Station

Inherits:
Object
  • Object
show all
Defined in:
lib/mbta/heavy_rail/station.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#lineObject (readonly)

Returns the value of attribute line.



4
5
6
# File 'lib/mbta/heavy_rail/station.rb', line 4

def line
  @line
end

#nameObject (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

#inspectObject



13
14
15
# File 'lib/mbta/heavy_rail/station.rb', line 13

def inspect
  %("#{@name}")
end