Use map instead of inject

This commit is contained in:
gregoirenovel 2018-01-15 21:33:29 +01:00
parent 490a6dee4c
commit c3754a173f
4 changed files with 10 additions and 10 deletions

View file

@ -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
[]

View file

@ -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