Class: Rome2rio::Route
- Inherits:
-
Object
- Object
- Rome2rio::Route
- Defined in:
- lib/rome2rio/response/route.rb
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
-
#stops ⇒ Object
readonly
Returns the value of attribute stops.
Instance Method Summary collapse
-
#initialize(json) ⇒ Route
constructor
A new instance of Route.
Constructor Details
#initialize(json) ⇒ Route
Returns a new instance of Route.
4 5 6 7 8 9 10 11 12 |
# File 'lib/rome2rio/response/route.rb', line 4 def initialize(json) @name = json["name"] @distance = json["distance"] @duration = json["duration"] @stops = [] json["stops"].each { |stop| @stops << Stop.new(stop) } @segments = [] json["segments"].each { |segment| @segments << Segment.new(segment) } end |
Instance Attribute Details
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
3 4 5 |
# File 'lib/rome2rio/response/route.rb', line 3 def distance @distance end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
3 4 5 |
# File 'lib/rome2rio/response/route.rb', line 3 def duration @duration end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rome2rio/response/route.rb', line 3 def name @name end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
3 4 5 |
# File 'lib/rome2rio/response/route.rb', line 3 def segments @segments end |
#stops ⇒ Object (readonly)
Returns the value of attribute stops.
3 4 5 |
# File 'lib/rome2rio/response/route.rb', line 3 def stops @stops end |