Class: TollBooth::Location
- Inherits:
-
Object
- Object
- TollBooth::Location
- Defined in:
- lib/toll_booth/location.rb
Overview
Represents a location that you would want directions from or to A location has the following attributes:
-
description
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
Instance Method Summary collapse
-
#drive_to(destinations) ⇒ TollBooth::RouteCollection
get driving routes to the destinations specified.
-
#initialize(description) ⇒ Location
constructor
create a new location.
Constructor Details
#initialize(description) ⇒ Location
create a new location
10 11 12 |
# File 'lib/toll_booth/location.rb', line 10 def initialize(description) @description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/toll_booth/location.rb', line 6 def description @description end |
Instance Method Details
#drive_to(destinations) ⇒ TollBooth::RouteCollection
get driving routes to the destinations specified
31 32 33 34 35 |
# File 'lib/toll_booth/location.rb', line 31 def drive_to(destinations) destinations = [destinations] if !destinations.is_a?(Array) TollBooth::Route.find(self, destinations) end |