lib/rcap/base/circle.rb in rcap-2.7.0 vs lib/rcap/base/circle.rb in rcap-2.7.3
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module RCAP
module Base
class Circle < Point
include Validation
@@ -33,16 +35,16 @@
# Returns a string representation of the circle of the form
# lattitude,longitude radius
#
# @return [String]
def to_s
- "#{ @lattitude },#{ @longitude } #{ @radius }"
+ "#{@lattitude},#{@longitude} #{@radius}"
end
# @return [String]
def inspect
- "(#{ self })"
+ "(#{self})"
end
# @return [REXML::Element]
def to_xml_element
xml_element = REXML::Element.new(XML_ELEMENT_NAME)
@@ -61,11 +63,11 @@
# @param [String] circle_string
# @return [Array(Float,Float,Float)]
def self.parse_circle_string(circle_string)
coordinates, radius = circle_string.split(' ')
lattitude, longitude = coordinates.split(',')
- [lattitude, longitude, radius].map { |e| e.to_f }
+ [lattitude, longitude, radius].map(&:to_f)
end
# @param [REXML::Element] circle_xml_element
# @return [Circle]
def self.from_xml_element(circle_xml_element)
@@ -89,10 +91,10 @@
circle.longitude = longitude.to_f
circle.radius = radius.to_f
end
end
- RADIUS_KEY = 'radius'
+ RADIUS_KEY = 'radius'
# @return [Hash]
def to_h
RCAP.attribute_values_to_hash([RADIUS_KEY, @radius],
[LATTITUDE_KEY, @lattitude],
[LONGITUDE_KEY, @longitude])