Sha256: 295fd0bd9e204d78d8aac5187f85964718199931472b78c4204218710b251bcb

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

Stored size: 660 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

10 entries across 10 versions & 2 rubygems

Version Path
jbox-gitolite-1.2.7 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.6 lib/gitolite/dirty_proxy.rb
gitolite-rugged-1.2.2 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.5 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.4 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.3 lib/gitolite/dirty_proxy.rb
gitolite-rugged-1.2.1.pre.devel lib/gitolite/dirty_proxy.rb
gitolite-rugged-1.2.pre.devel lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.2 lib/gitolite/dirty_proxy.rb
jbox-gitolite-1.2.1 lib/gitolite/dirty_proxy.rb