Class: SerializeWithCoder::JSONCoder

Inherits:
Object
  • Object
show all
Defined in:
lib/coders/json_coder.rb

Instance Method Summary collapse

Instance Method Details

#dump(obj) ⇒ Object



10
11
12
# File 'lib/coders/json_coder.rb', line 10

def dump(obj)
  obj.to_json rescue nil
end

#load(data) ⇒ Object



6
7
8
# File 'lib/coders/json_coder.rb', line 6

def load(data)
  JSON.parse(data) rescue nil
end