Module: RightResource::Formats::JsonFormat

Extended by:
JsonFormat
Included in:
JsonFormat
Defined in:
lib/right_resource/formats/json_format.rb

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object



18
19
20
# File 'lib/right_resource/formats/json_format.rb', line 18

def decode(json)
  Crack::JSON.parse(json)
end

#encode(hash) ⇒ Object



14
15
16
# File 'lib/right_resource/formats/json_format.rb', line 14

def encode(hash)
  JSON.generate(hash)
end

#extensionObject



6
7
8
# File 'lib/right_resource/formats/json_format.rb', line 6

def extension
  "js"
end

#mime_typeObject



10
11
12
# File 'lib/right_resource/formats/json_format.rb', line 10

def mime_type
  "application/json"
end