Class: ARSerializeHelpers::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/ar-serialize-helpers/json.rb

Instance Method Summary collapse

Instance Method Details

#dump(obj) ⇒ Object



4
5
6
# File 'lib/ar-serialize-helpers/json.rb', line 4

def dump obj
  obj.to_json if obj != nil
end

#load(text) ⇒ Object



8
9
10
# File 'lib/ar-serialize-helpers/json.rb', line 8

def load text
  ::JSON.parse(text) if text
end