Module: Geonames::JsonFormat

Extended by:
JsonFormat
Included in:
JsonFormat
Defined in:
lib/map_layers/geonames.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object



22
23
24
25
# File 'lib/map_layers/geonames.rb', line 22

def decode(json)
  h = ActiveSupport::JSON.decode(json)
  h.values.flatten # Return type must be an array of hashes
end

#encode(hash) ⇒ Object



18
19
20
# File 'lib/map_layers/geonames.rb', line 18

def encode(hash)
  hash.to_json
end

#extensionObject



10
11
12
# File 'lib/map_layers/geonames.rb', line 10

def extension
  "json"
end

#mime_typeObject



14
15
16
# File 'lib/map_layers/geonames.rb', line 14

def mime_type
  "application/json"
end