Module: Switches::JSONSerializer
Constant Summary collapse
- ParserError =
Class.new(MultiJson::LoadError)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.deserialize(json) ⇒ Object
19 20 21 22 23 |
# File 'lib/switches/json_serializer.rb', line 19 def deserialize(json) MultiJson.load(json) rescue Exception => e raise ParserError end |
.serialize(object) ⇒ Object
15 16 17 |
# File 'lib/switches/json_serializer.rb', line 15 def serialize(object) MultiJson.dump(object) end |
Instance Method Details
#as_json ⇒ Object
5 6 7 |
# File 'lib/switches/json_serializer.rb', line 5 def as_json raise NotImplementedError end |
#to_json ⇒ Object
9 10 11 |
# File 'lib/switches/json_serializer.rb', line 9 def to_json serialize(as_json) end |