Class: Bort::Schedule::StationLine

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

Overview

TODO: DRY with Leg?

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bike_flagObject

Returns the value of attribute bike_flag.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def bike_flag
  @bike_flag
end

#destination_timeObject

Returns the value of attribute destination_time.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def destination_time
  @destination_time
end

#indexObject

Returns the value of attribute index.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def index
  @index
end

#nameObject

Returns the value of attribute name.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def name
  @name
end

#origin_timeObject

Returns the value of attribute origin_time.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def origin_time
  @origin_time
end

#train_head_stationObject

Returns the value of attribute train_head_station.



327
328
329
# File 'lib/bort/schedule.rb', line 327

def train_head_station
  @train_head_station
end

Class Method Details

.parse(doc, date) ⇒ Object



328
329
330
331
332
333
334
335
336
337
338
# File 'lib/bort/schedule.rb', line 328

def self.parse(doc, date)
  line                    = StationLine.new
  line.name               = doc.attributes['line']
  line.train_head_station = doc.attributes['trainheadstation']
  line.origin_time        = Time.parse("#{date} #{doc.attributes['origtime']}")
  line.destination_time   = Time.parse("#{date} #{doc.attributes['desttime']}")
  line.index              = doc.attributes['trainidx'].to_i
  line.bike_flag          = doc.attributes['bikeflag'] == '1'

  line
end