class Taskflow::CustomHash
Public Class Methods
dump(obj)
click to toggle source
# File lib/taskflow/custom_hash.rb, line 7 def dump(obj) return unless obj unless obj.is_a?(HashWithIndifferentAccess) || obj.is_a?(Hash) raise ::ActiveRecord::SerializationTypeMismatch, "Attribute was supposed to be a Hash, but was a #{obj.class}. -- #{obj.inspect}" end JSON.dump obj end
load(str)
click to toggle source
# File lib/taskflow/custom_hash.rb, line 3 def load(str) return unless str HashWithIndifferentAccess.new JSON.parse(str) end