module CrateObject::ClassMethods

Public Instance Methods

dump(object) click to toggle source
# File lib/active_record/attribute_methods/crate_object.rb, line 34
def dump(object)
  object ? object.to_hash : nil
end
load(object) click to toggle source
# File lib/active_record/attribute_methods/crate_object.rb, line 25
def load(object)
  case object
    when String
      object.gsub!('=', ':')
      object = JSON.parse("{#{object}}")
  end
  new(object.symbolize_keys)
end