Sha256: 7bb7f669bcb10c9e53e8cd0bce5b372a7ffc72579f23228373873e05597bc1be

Contents?: true

Size: 521 Bytes

Versions: 18

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true
module Kasket
  module DirtyMixin
    def kasket_dirty_methods(*method_names)
      method_names.each do |method|
        without = "without_kasket_update_#{method}"
        break if method_defined? without

        alias_method without, method
        define_method method do |*args, &block|
          result = send(without, *args, &block)
          clear_kasket_indices
          result
        end
      end
    end

    alias_method :kasket_dirty_method, :kasket_dirty_methods
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kasket-4.14.2 lib/kasket/dirty_mixin.rb
kasket-4.14.1 lib/kasket/dirty_mixin.rb
kasket-4.14.0 lib/kasket/dirty_mixin.rb
kasket-4.13.0 lib/kasket/dirty_mixin.rb
kasket-4.12.0 lib/kasket/dirty_mixin.rb
kasket-4.11.0 lib/kasket/dirty_mixin.rb
kasket-4.10.4 lib/kasket/dirty_mixin.rb
kasket-4.10.2.1 lib/kasket/dirty_mixin.rb
kasket-4.10.0 lib/kasket/dirty_mixin.rb
kasket-4.9.1 lib/kasket/dirty_mixin.rb
kasket-4.9.0 lib/kasket/dirty_mixin.rb
kasket-4.8.0 lib/kasket/dirty_mixin.rb
kasket-4.7.0 lib/kasket/dirty_mixin.rb
kasket-4.6.0 lib/kasket/dirty_mixin.rb
kasket-4.5.1 lib/kasket/dirty_mixin.rb
kasket-4.5.0 lib/kasket/dirty_mixin.rb
kasket-4.4.5 lib/kasket/dirty_mixin.rb
kasket-4.4.4 lib/kasket/dirty_mixin.rb