Class: SurrealDB::GeometryPoint
- Inherits:
-
Object
- Object
- SurrealDB::GeometryPoint
- Defined in:
- lib/surrealdb/models/geometry.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #coordinates ⇒ Object
- #hash ⇒ Object
-
#initialize(longitude, latitude) ⇒ GeometryPoint
constructor
A new instance of GeometryPoint.
- #inspect ⇒ Object
Constructor Details
#initialize(longitude, latitude) ⇒ GeometryPoint
Returns a new instance of GeometryPoint.
7 8 9 10 |
# File 'lib/surrealdb/models/geometry.rb', line 7 def initialize(longitude, latitude) @longitude = longitude.to_f @latitude = latitude.to_f end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/surrealdb/models/geometry.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/surrealdb/models/geometry.rb', line 5 def longitude @longitude end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
16 17 18 |
# File 'lib/surrealdb/models/geometry.rb', line 16 def ==(other) other.is_a?(GeometryPoint) && other.longitude == @longitude && other.latitude == @latitude end |
#coordinates ⇒ Object
12 13 14 |
# File 'lib/surrealdb/models/geometry.rb', line 12 def coordinates [@longitude, @latitude] end |
#hash ⇒ Object
21 22 23 |
# File 'lib/surrealdb/models/geometry.rb', line 21 def hash [self.class, @longitude, @latitude].hash end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/surrealdb/models/geometry.rb', line 25 def inspect "GeometryPoint(#{@longitude}, #{@latitude})" end |