module Tr8n::ActiveDumper::ClassMethods

Public Instance Methods

_load(str) click to toggle source
# File lib/tr8n/active_dumper.rb, line 39
def _load(str)
  data = Marshal.load(str)

  raise Tr8n::Exception, 'invalid format' if not data.kind_of?(Hash) or data.keys.to_set != [:attributes, :new_record].to_set

  instance = new
  instance.instance_variable_set(:@attributes, data[:attributes])
  instance.instance_variable_set(:@new_record, data[:new_record])
  instance
end