lib/rcap/base/circle.rb in rcap-2.1.0 vs lib/rcap/base/circle.rb in rcap-2.2.0
- old
+ new
@@ -74,13 +74,13 @@
# @param [Array(Numeric, Numeric, Numeric)] circle_yaml_data lattitude, longitude, radius
# @return [Circle]
def self.from_yaml_data( circle_yaml_data )
lattitude, longitude, radius = circle_yaml_data
self.new do |circle|
- circle.lattitude = lattitude
- circle.longitude = longitude
- circle.radius = radius
+ circle.lattitude = lattitude.to_f
+ circle.longitude = longitude.to_f
+ circle.radius = radius.to_f
end
end
RADIUS_KEY = 'radius'
# @return [Hash]
@@ -92,13 +92,13 @@
# @param [Hash] circle_hash
# @return [Circle]
def self.from_h( circle_hash )
self.new do |circle|
- circle.radius = circle_hash[ RADIUS_KEY ]
- circle.lattitude = circle_hash[ LATTITUDE_KEY ]
- circle.longitude = circle_hash[ LONGITUDE_KEY ]
+ circle.radius = circle_hash[ RADIUS_KEY ].to_f
+ circle.lattitude = circle_hash[ LATTITUDE_KEY ].to_f
+ circle.longitude = circle_hash[ LONGITUDE_KEY ].to_f
end
end
# @return [Array(Numeric,Numeric,Numeric)]
def to_a
@@ -109,12 +109,12 @@
# @param [Array] circle_array
# @return [Circle]
def self.from_a( circle_array )
self.new do |circle|
- circle.longitude = circle_array[ LONGITUDE_INDEX ]
- circle.lattitude = circle_array[ LATTITUDE_INDEX ]
- circle.radius = circle_array[ RADIUS_INDEX ]
+ circle.longitude = circle_array[ LONGITUDE_INDEX ].to_f
+ circle.lattitude = circle_array[ LATTITUDE_INDEX ].to_f
+ circle.radius = circle_array[ RADIUS_INDEX ].to_f
end
end
end
end
end