Sha256: 9f0cf0e7ce5981ec82f460607444381b651c42b558a2e6aefd06cbde0ba6aa46

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

module MBTA
  module HeavyRail
    class Station
      attr_reader :line, :name
      attr_writer :platforms

      def initialize(line, name, platforms = [])
        @line = line
        @name = name
        @platforms = platforms
      end

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

      def platforms(direction = nil)
        if (direction)
          self[direction]
        else
          @platforms
        end
      end

      def [](direction)
        @platforms.find { |platform| platform.direction == direction }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mbta-0.1.4 lib/mbta/heavy_rail/station.rb
mbta-0.1.3 lib/mbta/heavy_rail/station.rb
mbta-0.1.1 lib/mbta/heavy_rail/station.rb