Class: JSONWithIndifferentAccess

Inherits:
Object
  • Object
show all
Defined in:
app/models/stance/event_record.rb

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object



14
15
16
# File 'app/models/stance/event_record.rb', line 14

def self.dump(obj)
  MultiJson.dump(obj)
end

.load(str) ⇒ Object



6
7
8
9
10
11
12
# File 'app/models/stance/event_record.rb', line 6

def self.load(str)
  return str unless str

  obj = HashWithIndifferentAccess.new(MultiJson.load(str))
  obj.freeze
  obj
end