Module: Chore::Encoder::JsonEncoder

Defined in:
lib/chore/encoders/json_encoder.rb

Overview

Json encoding for serializing jobs.

Class Method Summary collapse

Class Method Details

.decode(job) ⇒ Object

Decodes the job from JSON into a ruby Hash using the standard ruby JSON parsing library



14
15
16
# File 'lib/chore/encoders/json_encoder.rb', line 14

def decode(job)
  JSON.parse(job)
end

.encode(job) ⇒ Object

Encodes the job into JSON using the standard ruby JSON parsing library



9
10
11
# File 'lib/chore/encoders/json_encoder.rb', line 9

def encode(job)
  JSON.generate(job.to_hash)
end