Use map instead of inject
This commit is contained in:
parent
490a6dee4c
commit
c3754a173f
4 changed files with 10 additions and 10 deletions
|
@ -25,8 +25,8 @@ module Carto
|
|||
return []
|
||||
end
|
||||
|
||||
result['features'].inject([]) do |acc, feature|
|
||||
acc.push feature['properties']['label']
|
||||
result['features'].map do |feature|
|
||||
feature['properties']['label']
|
||||
end
|
||||
rescue TypeError, JSON::ParserError
|
||||
[]
|
||||
|
|
|
@ -8,11 +8,11 @@ class CARTO::SGMAP::Cadastre::Adapter
|
|||
end
|
||||
|
||||
def to_params
|
||||
data_source[:features].inject([]) do |acc, feature|
|
||||
data_source[:features].map do |feature|
|
||||
tmp = filter_properties feature[:properties]
|
||||
tmp[:geometry] = feature[:geometry]
|
||||
|
||||
acc << tmp
|
||||
tmp
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue