Class: Transport::Journey

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#capacity1stObject (readonly)

Returns the value of attribute capacity1st.



9
10
11
# File 'lib/journey.rb', line 9

def capacity1st
  @capacity1st
end

#capacity2ndObject (readonly)

Returns the value of attribute capacity2nd.



9
10
11
# File 'lib/journey.rb', line 9

def capacity2nd
  @capacity2nd
end

#categoryObject (readonly)

Returns the value of attribute category.



9
10
11
# File 'lib/journey.rb', line 9

def category
  @category
end

#categoryCodeObject (readonly)

Returns the value of attribute categoryCode.



9
10
11
# File 'lib/journey.rb', line 9

def categoryCode
  @categoryCode
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/journey.rb', line 9

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



9
10
11
# File 'lib/journey.rb', line 9

def number
  @number
end

#operatorObject (readonly)

Returns the value of attribute operator.



9
10
11
# File 'lib/journey.rb', line 9

def operator
  @operator
end

#passListObject (readonly)

Returns the value of attribute passList.



9
10
11
# File 'lib/journey.rb', line 9

def passList
  @passList
end

#stopObject (readonly)

Returns the value of attribute stop.



9
10
11
# File 'lib/journey.rb', line 9

def stop
  @stop
end

#toObject (readonly)

Returns the value of attribute to.



9
10
11
# File 'lib/journey.rb', line 9

def to
  @to
end