Class: Geodesics::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/geodesics/point.rb

Direct Known Subclasses

Degree, Radian

Constant Summary collapse

RADIAN =
Math::PI / 180
DEGREE =
180 / Math::PI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(latitude, longitude) ⇒ Point

Returns a new instance of Point.



10
11
12
13
# File 'lib/geodesics/point.rb', line 10

def initialize(latitude, longitude)
  @latitude = latitude
  @longitude = longitude
end

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



8
9
10
# File 'lib/geodesics/point.rb', line 8

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



8
9
10
# File 'lib/geodesics/point.rb', line 8

def longitude
  @longitude
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/geodesics/point.rb', line 15

def ==(other)
  latitude == other.latitude && longitude == other.longitude
end

#to_degreeObject



23
24
25
# File 'lib/geodesics/point.rb', line 23

def to_degree
  self
end

#to_radianObject



19
20
21
# File 'lib/geodesics/point.rb', line 19

def to_radian
  self
end