Class: RailFeeds::NetworkRail::Schedule::TrainSchedule::Location
- Inherits:
-
Object
- Object
- RailFeeds::NetworkRail::Schedule::TrainSchedule::Location
- Defined in:
- lib/rail_feeds/network_rail/schedule/train_schedule/location.rb,
lib/rail_feeds/network_rail/schedule/train_schedule/location/origin.rb,
lib/rail_feeds/network_rail/schedule/train_schedule/location/terminating.rb,
lib/rail_feeds/network_rail/schedule/train_schedule/location/intermediate.rb
Overview
A class for holding information about a particular train’s particular location.
Direct Known Subclasses
Defined Under Namespace
Classes: Intermediate, Origin, Terminating
Instance Attribute Summary collapse
- #activity ⇒ String
- #platform ⇒ String
-
#tiploc ⇒ String
The location where the change occurs.
- #tiploc_suffix ⇒ String
Class Method Summary collapse
-
.from_cif(line) ⇒ Object
Initialize a new location from a CIF file line (will be of the appropriate sub class).
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize ⇒ Location
constructor
A new instance of Location.
Constructor Details
#initialize ⇒ Location
Returns a new instance of Location.
20 21 22 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 20 def initialize fail 'This class should never be instantiated' end |
Instance Attribute Details
#activity ⇒ String
18 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 18 attr_accessor :tiploc, :tiploc_suffix, :platform, :activity |
#platform ⇒ String
18 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 18 attr_accessor :tiploc, :tiploc_suffix, :platform, :activity |
#tiploc ⇒ String
Returns The location where the change occurs.
18 19 20 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 18 def tiploc @tiploc end |
#tiploc_suffix ⇒ String
18 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 18 attr_accessor :tiploc, :tiploc_suffix, :platform, :activity |
Class Method Details
.from_cif(line) ⇒ Object
Initialize a new location from a CIF file line (will be of the appropriate sub class)
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 26 def self.from_cif(line) case line[0..1] when 'LO' Origin.from_cif line when 'LI' Intermediate.from_cif line when 'LT' Terminating.from_cif line else fail ArgumentError, "Improper line type #{line[0..1]}: #{line}" end end |
Instance Method Details
#==(other) ⇒ Object
39 40 41 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 39 def ==(other) hash == other&.hash end |
#hash ⇒ Object
43 44 45 |
# File 'lib/rail_feeds/network_rail/schedule/train_schedule/location.rb', line 43 def hash "#{tiploc}-#{tiploc_suffix}" end |