Class: Transport::Stop

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stop) ⇒ Stop

Returns a new instance of Stop.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/stop.rb', line 9

def initialize(stop)
  return unless stop
  
  @station = Station.new stop['station']
  @arrival = DateTime.parse stop['arrival'] if stop['arrival'] 
  @departure = DateTime.parse stop['departure'] if stop['departure'] 
  @delay = stop['delay'].to_i if stop['delay']
  @platform =  stop['platform'] if stop['platform']
  @prognosis = Prognosis.new stop['prognosis']
  @realtimeAvailability = stop['realtimeAvailability']
end

Instance Attribute Details

#arrivalObject (readonly)

Returns the value of attribute arrival.



7
8
9
# File 'lib/stop.rb', line 7

def arrival
  @arrival
end

#delayObject (readonly)

Returns the value of attribute delay.



7
8
9
# File 'lib/stop.rb', line 7

def delay
  @delay
end

#departureObject (readonly)

Returns the value of attribute departure.



7
8
9
# File 'lib/stop.rb', line 7

def departure
  @departure
end

#realtimeAvailabilityObject (readonly)

Returns the value of attribute realtimeAvailability.



7
8
9
# File 'lib/stop.rb', line 7

def realtimeAvailability
  @realtimeAvailability
end

#stationObject (readonly)

Returns the value of attribute station.



7
8
9
# File 'lib/stop.rb', line 7

def station
  @station
end