Class: CoderDecorator::Coders::JSON

Inherits:
Coder
  • Object
show all
Defined in:
lib/coder_decorator/coders/json.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Coder

#coder

Instance Method Summary collapse

Methods inherited from Coder

#initialize

Constructor Details

This class inherits a constructor from CoderDecorator::Coders::Coder

Instance Method Details

#decode(str) ⇒ Object



12
13
14
# File 'lib/coder_decorator/coders/json.rb', line 12

def decode(str)
  coder.decode(::JSON.parse(str))
end

#encode(obj) ⇒ Object



8
9
10
# File 'lib/coder_decorator/coders/json.rb', line 8

def encode(obj)
  ::JSON.dump(coder.encode(obj))
end