mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 23:21:30 +08:00
12 lines
209 B
Ruby
12 lines
209 B
Ruby
|
class JsonbHashSerializer
|
||
|
def self.dump(hash)
|
||
|
hash.to_json
|
||
|
end
|
||
|
|
||
|
def self.load(hash)
|
||
|
hash ||= {}
|
||
|
hash = JSON.parse(hash) if hash.instance_of? String
|
||
|
hash.with_indifferent_access
|
||
|
end
|
||
|
end
|