Class: GridSquare::Location
- Inherits:
-
Object
- Object
- GridSquare::Location
- Defined in:
- lib/location.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Instance Method Summary collapse
- #*(scalar) ⇒ Object
- #+(other) ⇒ Object
- #-(other) ⇒ Object
- #/(scalar) ⇒ Object
-
#initialize(longitude, latitude) ⇒ Location
constructor
A new instance of Location.
Constructor Details
#initialize(longitude, latitude) ⇒ Location
Returns a new instance of Location.
4 5 6 |
# File 'lib/location.rb', line 4 def initialize(longitude, latitude) @longitude, @latitude = longitude, latitude end |
Instance Attribute Details
#latitude ⇒ Object
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/location.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/location.rb', line 3 def longitude @longitude end |
Instance Method Details
#*(scalar) ⇒ Object
12 13 14 |
# File 'lib/location.rb', line 12 def *(scalar) Location.new longitude*scalar, latitude*scalar end |
#+(other) ⇒ Object
16 17 18 |
# File 'lib/location.rb', line 16 def +(other) Location.new longitude+other.longitude, latitude+other.latitude end |