class Motor::HashSerializer
Public Class Methods
dump(hash)
click to toggle source
# File lib/motor/hash_serializer.rb, line 5 def self.dump(hash) hash.to_json end
load(hash)
click to toggle source
# File lib/motor/hash_serializer.rb, line 9 def self.load(hash) return hash unless hash hash = JSON.parse(hash.presence || '{}') if hash.is_a?(String) if hash.is_a?(Hash) hash.with_indifferent_access else hash || {} end end