Class: ActiveSaga::Serializers::Json

Inherits:
Object
  • Object
show all
Defined in:
lib/active_saga/serializers/json.rb

Overview

Simple JSON wrapper allowing custom serialization strategies.

Instance Method Summary collapse

Instance Method Details

#dump(object) ⇒ Object



9
10
11
# File 'lib/active_saga/serializers/json.rb', line 9

def dump(object)
  JSON.generate(object)
end

#load(payload) ⇒ Object



13
14
15
16
17
# File 'lib/active_saga/serializers/json.rb', line 13

def load(payload)
  return {} if payload.nil? || payload == ""

  JSON.parse(payload)
end