Class: Train
- Inherits:
-
Object
- Object
- Train
- Defined in:
- lib/common/train.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_updated ⇒ Object
Returns the value of attribute last_updated.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(system_event) ⇒ Train
constructor
A new instance of Train.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(system_event) ⇒ Train
Returns a new instance of Train.
6 7 8 9 10 11 12 |
# File 'lib/common/train.rb', line 6 def initialize(system_event) @id = system_event[] @direction = system_event[] @line = system_event[] @destination = system_event[] @last_updated = system_event[] end |
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
4 5 6 |
# File 'lib/common/train.rb', line 4 def destination @destination end |
#direction ⇒ Object
Returns the value of attribute direction.
4 5 6 |
# File 'lib/common/train.rb', line 4 def direction @direction end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/common/train.rb', line 4 def id @id end |
#last_updated ⇒ Object
Returns the value of attribute last_updated.
4 5 6 |
# File 'lib/common/train.rb', line 4 def last_updated @last_updated end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/common/train.rb', line 4 def line @line end |
Instance Method Details
#as_json(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/common/train.rb', line 14 def as_json(={}) { id: @id, direction: @direction, line: @line, destination: @destination, last_updated: @last_updated } end |
#to_json(*options) ⇒ Object
24 25 26 |
# File 'lib/common/train.rb', line 24 def to_json(*) as_json(*).to_json(*) end |