Method: Bahn::Stop#initialize

Defined in:
lib/bahn.rb

#initialize(opts) ⇒ Stop

 :nodoc:



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/bahn.rb', line 333

def initialize(opts) # :nodoc:
  # for the following fields, use :none to mean none supplied (as opposed to not fetched yet):
  # @arrival_time, @departure_time, @platform, @arrival_time_from_origin, @departure_time_from_origin

  @station = opts[:station] # required
  @service = opts[:service] # required
  @arrival_time = opts[:arrival_time]
  @departure_time = opts[:departure_time] # arrival_time or departure_time is required
  @platform = opts[:platform]
  @arrival_time_from_origin = opts[:arrival_time_from_origin]
  @departure_time_from_origin = opts[:departure_time_from_origin]

  @inferred_time_to_destination = opts[:inferred_time_to_destination]
  
  # these can be calculated from arrival_time_from_origin and departure_time_from_origin
  # (but require service.origin, and therefore service.stops, to have been looked up)
  @arrival_time_to_destination = opts[:arrival_time_to_destination]
  @departure_time_to_destination = opts[:departure_time_to_destination]
end