Class: TrainStop
- Inherits:
-
Object
- Object
- TrainStop
- Defined in:
- lib/viaggiatreno/train_stop.rb
Instance Attribute Summary collapse
-
#actual_stop_time ⇒ Object
Returns the value of attribute actual_stop_time.
-
#scheduled_stop_time ⇒ Object
Returns the value of attribute scheduled_stop_time.
-
#status ⇒ Object
Returns the value of attribute status.
-
#train_station ⇒ Object
Returns the value of attribute train_station.
Instance Method Summary collapse
-
#initialize(train_station, scheduled_stop_time, actual_stop_time, status) ⇒ TrainStop
constructor
A new instance of TrainStop.
- #to_s ⇒ Object
Constructor Details
#initialize(train_station, scheduled_stop_time, actual_stop_time, status) ⇒ TrainStop
Returns a new instance of TrainStop.
6 7 8 9 10 11 |
# File 'lib/viaggiatreno/train_stop.rb', line 6 def initialize(train_station, scheduled_stop_time, actual_stop_time, status) @train_station = train_station @scheduled_stop_time = scheduled_stop_time @actual_stop_time = actual_stop_time @status = status end |
Instance Attribute Details
#actual_stop_time ⇒ Object
Returns the value of attribute actual_stop_time.
4 5 6 |
# File 'lib/viaggiatreno/train_stop.rb', line 4 def actual_stop_time @actual_stop_time end |
#scheduled_stop_time ⇒ Object
Returns the value of attribute scheduled_stop_time.
4 5 6 |
# File 'lib/viaggiatreno/train_stop.rb', line 4 def scheduled_stop_time @scheduled_stop_time end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/viaggiatreno/train_stop.rb', line 4 def status @status end |
#train_station ⇒ Object
Returns the value of attribute train_station.
4 5 6 |
# File 'lib/viaggiatreno/train_stop.rb', line 4 def train_station @train_station end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/viaggiatreno/train_stop.rb', line 13 def to_s retstr = '' if @status == TrainStopState::DONE done = 'X' actual_or_expected = 'ACTUAL' elsif @status == TrainStopState::TO_BE_DONE done = ' ' actual_or_expected = 'EXPECTED' end retstr += "[#{done}] #{train_station} = SCHEDULED: #{scheduled_stop_time}"\ " #{actual_or_expected}: #{actual_stop_time}" retstr end |