Sha256: 6be2be2e24760dc7b001c9c21cfaf7e1f74c070a19022cd4abdb285a6637b7c8

Contents?: true

Size: 480 Bytes

Versions: 6

Compression:

Stored size: 480 Bytes

Contents

module CacheBack
  module DirtyMixin
    def cache_back_dirty_methods(*method_names)
      method_names.each do |method|
        unless method_defined?("without_cache_back_update_#{method}")
          alias_method("without_cache_back_update_#{method}", method)
          define_method(method) do |*args|
            result = send("without_cache_back_update_#{method}", *args)
            store_in_cache_back
            result
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cache_back-0.4.1 lib/cache_back/dirty_mixin.rb
cache_back-0.3.4 lib/cache_back/dirty_mixin.rb
cache_back-0.3.3 lib/cache_back/dirty_mixin.rb
cache_back-0.3.2 lib/cache_back/dirty_mixin.rb
cache_back-0.3.1 lib/cache_back/dirty_mixin.rb
cache_back-0.3.0 lib/cache_back/dirty_mixin.rb