class Libis::Workflow::ActiveRecord::Helpers::HashSerializer
Public Class Methods
dump(hash)
click to toggle source
# File lib/libis/workflow/activerecord/helpers/hash_serializer.rb, line 11 def self.dump(hash) delete_proc = Proc.new do |_, v| # Cleanup the hash recursively and remove entries with value == nil # noinspection RubyScope v.delete_if(&delete_proc) if v.kind_of?(Hash) v.nil? end hash.delete_if &delete_proc if hash.is_a?(Hash) # Store a nil value if the hash is empty (hash.is_a?(Hash) && !hash.empty?) ? hash : nil end
load(hash)
click to toggle source
# File lib/libis/workflow/activerecord/helpers/hash_serializer.rb, line 23 def self.load(hash) (hash || {}).with_indifferent_access end