Class: Transport::Checkpoint
- Inherits:
-
Object
- Object
- Transport::Checkpoint
- Defined in:
- lib/checkpoint.rb
Instance Attribute Summary collapse
-
#arrival ⇒ Object
readonly
Returns the value of attribute arrival.
-
#departure ⇒ Object
readonly
Returns the value of attribute departure.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#prognosis ⇒ Object
readonly
Returns the value of attribute prognosis.
-
#station ⇒ Object
readonly
Returns the value of attribute station.
Instance Method Summary collapse
-
#initialize(checkpoint) ⇒ Checkpoint
constructor
A new instance of Checkpoint.
Constructor Details
#initialize(checkpoint) ⇒ Checkpoint
Returns a new instance of Checkpoint.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/checkpoint.rb', line 12 def initialize(checkpoint) return unless checkpoint @station = Station.new checkpoint['station'] @arrival = DateTime.parse(checkpoint['arrival']) if checkpoint['arrival'] @departure = DateTime.parse(checkpoint['departure']) if checkpoint['departure'] @delay = checkpoint['delay'].to_i if checkpoint['delay'] @platform = checkpoint['platform'] @prognosis = Prognosis.new checkpoint['prognosis'] end |
Instance Attribute Details
#arrival ⇒ Object (readonly)
Returns the value of attribute arrival.
10 11 12 |
# File 'lib/checkpoint.rb', line 10 def arrival @arrival end |
#departure ⇒ Object (readonly)
Returns the value of attribute departure.
10 11 12 |
# File 'lib/checkpoint.rb', line 10 def departure @departure end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
10 11 12 |
# File 'lib/checkpoint.rb', line 10 def platform @platform end |
#prognosis ⇒ Object (readonly)
Returns the value of attribute prognosis.
10 11 12 |
# File 'lib/checkpoint.rb', line 10 def prognosis @prognosis end |
#station ⇒ Object (readonly)
Returns the value of attribute station.
10 11 12 |
# File 'lib/checkpoint.rb', line 10 def station @station end |