Class: Transport::Journey
- Inherits:
-
Object
- Object
- Transport::Journey
- Defined in:
- lib/journey.rb
Instance Attribute Summary collapse
-
#capacity1st ⇒ Object
readonly
Returns the value of attribute capacity1st.
-
#capacity2nd ⇒ Object
readonly
Returns the value of attribute capacity2nd.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#categoryCode ⇒ Object
readonly
Returns the value of attribute categoryCode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#passList ⇒ Object
readonly
Returns the value of attribute passList.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(journey) ⇒ Journey
constructor
A new instance of Journey.
Constructor Details
#initialize(journey) ⇒ Journey
Returns a new instance of Journey.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/journey.rb', line 11 def initialize(journey) return unless journey @stop = Stop.new journey['stop'] @name = journey['name'] @category = journey['category'] @subcategory = journey['subcategory'] @categoryCode = journey['categoryCode'] @number = journey['number'].to_i @operator = journey['operator'] @to = journey['to'] @passList = journey['passList'].map { |checkpoint| Checkpoint.new checkpoint } @capacity1st = journey['capacity1st'] @capacity2nd = journey['capacity2nd'] end |
Instance Attribute Details
#capacity1st ⇒ Object (readonly)
Returns the value of attribute capacity1st.
9 10 11 |
# File 'lib/journey.rb', line 9 def capacity1st @capacity1st end |
#capacity2nd ⇒ Object (readonly)
Returns the value of attribute capacity2nd.
9 10 11 |
# File 'lib/journey.rb', line 9 def capacity2nd @capacity2nd end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
9 10 11 |
# File 'lib/journey.rb', line 9 def category @category end |
#categoryCode ⇒ Object (readonly)
Returns the value of attribute categoryCode.
9 10 11 |
# File 'lib/journey.rb', line 9 def categoryCode @categoryCode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/journey.rb', line 9 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/journey.rb', line 9 def number @number end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
9 10 11 |
# File 'lib/journey.rb', line 9 def operator @operator end |
#passList ⇒ Object (readonly)
Returns the value of attribute passList.
9 10 11 |
# File 'lib/journey.rb', line 9 def passList @passList end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
9 10 11 |
# File 'lib/journey.rb', line 9 def stop @stop end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
9 10 11 |
# File 'lib/journey.rb', line 9 def to @to end |