Class: Bort::Realtime::Train

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, orig, dest) ⇒ Train

Returns a new instance of Train.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/bort/realtime.rb', line 66

def initialize(doc, orig, dest)
  self.station      = orig
  self.destination  = dest
  self.minutes      = (doc/:minutes).inner_text.to_i
  self.platform     = (doc/:platform).inner_text.to_i
  self.direction    = (doc/:direction).inner_text[0,1].downcase
  self.length       = (doc/:length).inner_text.to_i
  self.color        = (doc/:color).inner_text.downcase
  self.hexcolor     = (doc/:hexcolor).inner_text.downcase
  self.bike_flag    = (doc/:bikeflag).inner_text == '1'
end

Instance Attribute Details

#bike_flagObject

Returns the value of attribute bike_flag.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def bike_flag
  @bike_flag
end

#colorObject

Returns the value of attribute color.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def color
  @color
end

#destinationObject

Returns the value of attribute destination.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def destination
  @destination
end

#directionObject

Returns the value of attribute direction.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def direction
  @direction
end

#hexcolorObject

Returns the value of attribute hexcolor.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def hexcolor
  @hexcolor
end

#lengthObject

Returns the value of attribute length.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def length
  @length
end

#minutesObject

Returns the value of attribute minutes.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def minutes
  @minutes
end

#platformObject

Returns the value of attribute platform.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def platform
  @platform
end

#stationObject

Returns the value of attribute station.



64
65
66
# File 'lib/bort/realtime.rb', line 64

def station
  @station
end