Class: Nominatim::Point

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lat, lon) ⇒ Point


9
10
11
# File 'lib/nominatim/point.rb', line 9

def initialize(lat, lon)
  @lat, @lon = lat.to_f, lon.to_f if lat && lon
end

Instance Attribute Details

#latObject (readonly) Also known as: latitude

Returns the value of attribute lat


3
4
5
# File 'lib/nominatim/point.rb', line 3

def lat
  @lat
end

#lonObject (readonly) Also known as: longitude

Returns the value of attribute lon


3
4
5
# File 'lib/nominatim/point.rb', line 3

def lon
  @lon
end

Instance Method Details

#==(other) ⇒ true, false


26
27
28
# File 'lib/nominatim/point.rb', line 26

def ==(other)
  self.to_a == other.to_a
end

#to_aArray


14
15
16
# File 'lib/nominatim/point.rb', line 14

def to_a
  [lat, lon]
end

#to_sString

Return a string representation of the point


21
22
23
# File 'lib/nominatim/point.rb', line 21

def to_s
  to_a.to_s
end