Class: Transport::Checkpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/checkpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#arrivalObject (readonly)

Returns the value of attribute arrival.



10
11
12
# File 'lib/checkpoint.rb', line 10

def arrival
  @arrival
end

#departureObject (readonly)

Returns the value of attribute departure.



10
11
12
# File 'lib/checkpoint.rb', line 10

def departure
  @departure
end

#platformObject (readonly)

Returns the value of attribute platform.



10
11
12
# File 'lib/checkpoint.rb', line 10

def platform
  @platform
end

#prognosisObject (readonly)

Returns the value of attribute prognosis.



10
11
12
# File 'lib/checkpoint.rb', line 10

def prognosis
  @prognosis
end

#stationObject (readonly)

Returns the value of attribute station.



10
11
12
# File 'lib/checkpoint.rb', line 10

def station
  @station
end