Class: MessageBus::Codec::Oj
Instance Method Summary collapse
- #decode(payload) ⇒ Object
- #encode(hash) ⇒ Object
-
#initialize(options = { mode: :compat }) ⇒ Oj
constructor
A new instance of Oj.
Constructor Details
#initialize(options = { mode: :compat }) ⇒ Oj
Returns a new instance of Oj.
8 9 10 |
# File 'lib/message_bus/codec/oj.rb', line 8 def initialize( = { mode: :compat }) @options = end |
Instance Method Details
#decode(payload) ⇒ Object
16 17 18 |
# File 'lib/message_bus/codec/oj.rb', line 16 def decode(payload) ::Oj.load(payload, @options) end |
#encode(hash) ⇒ Object
12 13 14 |
# File 'lib/message_bus/codec/oj.rb', line 12 def encode(hash) ::Oj.dump(hash, @options) end |