Class: CartoJson::Circle

Inherits:
Point
  • Object
show all
Defined in:
lib/carto_json/circle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Point

#==, #initialize, #to_hash_for_array

Methods included from Shape

included, #initialize, #to_json, #to_pretty_json, #to_s, #type

Constructor Details

This class inherits a constructor from CartoJson::Point

Instance Attribute Details

#radiusObject

Returns the value of attribute radius.



5
6
7
# File 'lib/carto_json/circle.rb', line 5

def radius
  @radius
end

Instance Method Details

#to_hashObject



24
25
26
27
28
29
30
# File 'lib/carto_json/circle.rb', line 24

def to_hash
  {:type    => self.class.type,
   LAT   => send(LAT),
   LNG   => send(LNG),
  :radius => radius
  }
end

#to_pointObject



20
21
22
# File 'lib/carto_json/circle.rb', line 20

def to_point
  Point.new LAT => send(LAT), LNG => send(LNG)
end

#to_wktObject



16
17
18
# File 'lib/carto_json/circle.rb', line 16

def to_wkt
  raise NotImplementedError, 'WKT does not support circles directly, conversion to polygon is required'
end