module Midnight::Utilities::JsonSerializer
Public Instance Methods
dump(hash)
click to toggle source
# File lib/midnight/utilities/json_serializer.rb, line 7 def dump(hash) hash = hash.try(:to_hash) || hash ::JSON.dump(hash) rescue ::TypeError hash end
load(string)
click to toggle source
# File lib/midnight/utilities/json_serializer.rb, line 14 def load(string) hash = ::JSON.load(string) hash.try(:to_hash).try(:deep_symbolize_keys) || hash rescue ::TypeError string end