Module: ActAsDirty::ActiveModel::Cleans
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveSupport::Callbacks
- Included in:
- ActAsDirty::ActiveRecord::Cleans
- Defined in:
- lib/act_as_dirty/active_model/cleans.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #clean?(context = nil) ⇒ Boolean
- #dirt ⇒ Object
- #dirty?(context = nil) ⇒ Boolean
- #read_changes_for_cleaning(key) ⇒ Object
Instance Method Details
#clean?(context = nil) ⇒ Boolean
98 99 100 101 102 103 104 |
# File 'lib/act_as_dirty/active_model/cleans.rb', line 98 def clean?(context= nil) current_context, self.cleaning_context = cleaning_context, context dirt.clear run_cleaners! ensure self.cleaning_context = current_context end |
#dirt ⇒ Object
94 95 96 |
# File 'lib/act_as_dirty/active_model/cleans.rb', line 94 def dirt @dirt ||= Dirt.new(self) end |
#dirty?(context = nil) ⇒ Boolean
106 107 108 |
# File 'lib/act_as_dirty/active_model/cleans.rb', line 106 def dirty?(context = nil) !clean?(context) end |
#read_changes_for_cleaning(key) ⇒ Object
110 111 112 |
# File 'lib/act_as_dirty/active_model/cleans.rb', line 110 def read_changes_for_cleaning(key) [self.changes[key][0], self.changes[key][1]] end |