lib/carto_json/circle.rb in carto_json-0.0.6 vs lib/carto_json/circle.rb in carto_json-0.0.7

- old
+ new

@@ -3,13 +3,14 @@ type :circle attr_accessor :radius def radius=(r) + r = r.to_f + # raise InvalidRadiusError, 'radius must be a number' unless (r.is_a?(Integer) || r.is_a?(Float)) raise InvalidRadiusError, 'radius cannot be negative' if r < 0 raise InvalidRadiusError, 'radius cannot be blank' if r.nil? - raise InvalidRadiusError, 'radius must be a number' unless (r.is_a?(Integer) || r.is_a?(Float)) raise InvalidRadiusError, 'radius cannot be zero' if r == 0 @radius = r end def to_wkt @@ -20,14 +21,12 @@ Point.new LAT => send(LAT), LNG => send(LNG) end def to_hash {:type => self.class.type, - :center => { - LAT => send(LAT), - LNG => send(LNG) - }, - :radius => radius + LAT => send(LAT), + LNG => send(LNG), + :radius => radius } end end end \ No newline at end of file