module Switches::JSONSerializer

Constants

ParserError

Public Instance Methods

as_json() click to toggle source
# File lib/switches/json_serializer.rb, line 5
def as_json
  raise NotImplementedError
end
deserialize(json) click to toggle source
# File lib/switches/json_serializer.rb, line 19
def deserialize(json)
  MultiJson.load(json)
rescue Exception => e
  raise ParserError
end
serialize(object) click to toggle source
# File lib/switches/json_serializer.rb, line 15
def serialize(object)
  MultiJson.dump(object)
end
to_json() click to toggle source
# File lib/switches/json_serializer.rb, line 9
def to_json
  serialize(as_json)
end