Class: Metrorail::Location
- Inherits:
-
Object
- Object
- Metrorail::Location
- Defined in:
- lib/metrorail.rb
Overview
A class representing a location (i.e. latitude/longitude)
Instance Attribute Summary collapse
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lon ⇒ Object
readonly
Returns the value of attribute lon.
Instance Method Summary collapse
-
#initialize(lat, lon) ⇒ Location
constructor
A new instance of Location.
- #to_s ⇒ Object
Constructor Details
#initialize(lat, lon) ⇒ Location
Returns a new instance of Location.
18 19 20 21 |
# File 'lib/metrorail.rb', line 18 def initialize(lat, lon) @lat = lat @lon = lon end |
Instance Attribute Details
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
17 18 19 |
# File 'lib/metrorail.rb', line 17 def lat @lat end |
#lon ⇒ Object (readonly)
Returns the value of attribute lon.
17 18 19 |
# File 'lib/metrorail.rb', line 17 def lon @lon end |
Instance Method Details
#to_s ⇒ Object
23 24 25 |
# File 'lib/metrorail.rb', line 23 def to_s return "<Location: #{@lat}, #{@lon}>" end |