Class: AcidicJob::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/acidic_job/serializer.rb

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object



16
17
18
19
20
21
# File 'lib/acidic_job/serializer.rb', line 16

def dump(obj)
  data = Arguments.send :serialize_argument, obj
  data.to_json
rescue ActiveJob::SerializationError
  raise UnserializableValue
end

.load(json) ⇒ Object



9
10
11
12
13
14
# File 'lib/acidic_job/serializer.rb', line 9

def load(json)
  return if json.nil? || json.empty?

  data = JSON.parse(json)
  Arguments.send :deserialize_argument, data
end