mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Avoid __send__.
This commit is contained in:
parent
dd507e3cbf
commit
10adab94db
1 changed files with 11 additions and 3 deletions
|
@ -16,9 +16,17 @@ class Location
|
|||
self.lat, self.lng = data
|
||||
when Hash, Location
|
||||
data.each { |key, value|
|
||||
begin
|
||||
__send__("#{key}=", value)
|
||||
rescue NameError
|
||||
case key.to_sym
|
||||
when :lat, :latitude
|
||||
self.lat = value
|
||||
when :lng, :longitude
|
||||
self.lng = value
|
||||
when :radius
|
||||
self.radius = value
|
||||
when :speed
|
||||
self.speed = value
|
||||
when :course
|
||||
self.course = value
|
||||
end
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue