class Stargate::Codec::JSON

Internal: Default codec based on JSON parser.

Public Class Methods

content_type() click to toggle source
# File lib/stargate/codec/json.rb, line 11
def self.content_type
  'application/json'
end
decode(str) click to toggle source
# File lib/stargate/codec/json.rb, line 19
def self.decode(str)
  ::JSON.parse(str)
rescue ::JSON::ParserError => err
  raise DecodeError, "Arguments cannot be decoded: JSON parser error"
end
encode(obj) click to toggle source
# File lib/stargate/codec/json.rb, line 15
def self.encode(obj)
  obj.to_json
end
id() click to toggle source
# File lib/stargate/codec/json.rb, line 7
def self.id
  :json
end