Module: HashPipe::InstanceMethods
- Defined in:
- lib/hashpipe.rb
Instance Method Summary collapse
- #archive_stash_for(model) ⇒ Object
- #destroy_archived_attributes ⇒ Object
- #each_archived_stash ⇒ Object
- #save_archived_attributes ⇒ Object
Instance Method Details
#archive_stash_for(model) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/hashpipe.rb', line 47 def archive_stash_for(model) @_archived_attribute_stashes ||= {} @_archived_attribute_stashes[model] ||= ArchivedAttribute.new( model, self, self.class.archived_attribute_definitions[model] ) end |
#destroy_archived_attributes ⇒ Object
66 67 68 69 70 |
# File 'lib/hashpipe.rb', line 66 def destroy_archived_attributes each_archived_stash do |name, stash| stash.__send__(:destroy) end end |
#each_archived_stash ⇒ Object
54 55 56 57 58 |
# File 'lib/hashpipe.rb', line 54 def each_archived_stash self.class.archived_attribute_definitions.each do |name, definition| yield(name, archive_stash_for(name)) end end |
#save_archived_attributes ⇒ Object
60 61 62 63 64 |
# File 'lib/hashpipe.rb', line 60 def save_archived_attributes each_archived_stash do |name, stash| stash.__send__(:save) end end |