Sha256: 1948668375d7126cdbde929fdb2a5cef39e2dd6bcb80e11eba68eda32e11c3d1

Contents?: true

Size: 657 Bytes

Versions: 11

Compression:

Stored size: 657 Bytes

Contents

module Gitolite
  # Very simple proxy object for checking if the proxied object was modified
  # since the last clean_up! method called. It works correctly only for objects
  # with proper hash method!

  class DirtyProxy < BasicObject

    def initialize(target)
      @target = target
      clean_up!
    end

    def method_missing(method, *args, &block)
      @target.send(method, *args, &block)
    end

    def respond_to?(symbol, include_private=false)
      super || [:dirty?, :clean_up!].include?(symbol.to_sym)
    end

    def dirty?
      @clean_hash != @target.hash
    end

    def clean_up!
      @clean_hash = @target.hash
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
jbox-gitolite-1.2.0 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.11 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.10 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.9 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.8 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.7 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.6 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.5 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.4 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.3 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.1.2 lib/gitolite/dirty_proxy.rb