Module: Tr8n::ActiveDumper::ClassMethods
- Defined in:
- lib/tr8n/active_dumper.rb
Instance Method Summary collapse
Instance Method Details
#_load(str) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# 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 |