Class: LayersOfLondon::Booth::MapTool::Polygon

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/layers_of_london/booth/map_tool/polygon.rb

Instance Method Summary collapse

Instance Method Details

#to_json(user_can_edit: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/layers_of_london/booth/map_tool/polygon.rb', line 8

def to_json(user_can_edit: false)
  json_feature = {'properties' => {}}.merge(feature)
  json_feature.inject({}) do |hash, (k,v)|
    if k === 'properties'
      v.merge!({'id' => id, 'userCanEdit': user_can_edit})
    end

    hash[k] = v
    hash
  end
end