Module: Kasket::DirtyMixin

Defined in:
lib/kasket/dirty_mixin.rb

Instance Method Summary collapse

Instance Method Details

#kasket_dirty_methods(*method_names) ⇒ Object Also known as: kasket_dirty_method



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kasket/dirty_mixin.rb', line 4

def kasket_dirty_methods(*method_names)
  method_names.each do |method|
    unless method_defined?("without_kasket_update_#{method}")
      alias_method("without_kasket_update_#{method}", method)
      define_method(method) do |*args|
        result = send("without_kasket_update_#{method}", *args)
        clear_kasket_indices
        result
      end
    end
  end
end