Class: CloudMade::Point
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
Instance Method Summary collapse
- #==(point) ⇒ Object
-
#initialize(*args) ⇒ Point
constructor
Posible initializers are Point.new(1, -1) Point.new([1, -1]).
- #to_latlon ⇒ Object
- #to_s ⇒ Object
Methods inherited from Geometry
Constructor Details
#initialize(*args) ⇒ Point
Posible initializers are Point.new(1, -1) Point.new([1, -1])
41 42 43 44 45 46 47 48 49 |
# File 'lib/geometry.rb', line 41 def initialize(*args) if args.size == 1 @lat = args[0][0] @lon = args[0][1] elsif args.size == 2 @lat = args[0] @lon = args[1] end end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
35 36 37 |
# File 'lib/geometry.rb', line 35 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
36 37 38 |
# File 'lib/geometry.rb', line 36 def lon @lon end |
Instance Method Details
#==(point) ⇒ Object
51 52 53 |
# File 'lib/geometry.rb', line 51 def ==(point) return (point.lat == @lat and point.lon == @lon) end |
#to_latlon ⇒ Object
59 60 61 |
# File 'lib/geometry.rb', line 59 def to_latlon "#{@lat},#{@lon}" end |
#to_s ⇒ Object
55 56 57 |
# File 'lib/geometry.rb', line 55 def to_s "Point(#{@lat},#{@lon})" end |