Sha256: f0738c54699ed4e3849e317e0d5eaf048c27fd201a8fe191aa96c5902c2aa1d8

Contents?: true

Size: 563 Bytes

Versions: 68

Compression:

Stored size: 563 Bytes

Contents

module Volt
  class HashDependency
    def initialize
      @hash_depedencies = {}
    end

    def depend(key)
      ensure_key(key).depend
    end

    def changed!(key)
      ensure_key(key).changed!
    end

    def delete(key)
      dep = @hash_depedencies.delete(key)

      if dep
        dep.changed!
        dep.remove
      end
    end

    def changed_all!
      @hash_depedencies.each_pair do |key, value|
        value.changed!
      end
    end

    private

    def ensure_key(key)
      @hash_depedencies[key] ||= Dependency.new
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
volt-0.8.24 lib/volt/reactive/hash_dependency.rb
volt-0.8.23 lib/volt/reactive/hash_dependency.rb
volt-0.8.22 lib/volt/reactive/hash_dependency.rb
volt-0.8.22.beta2 lib/volt/reactive/hash_dependency.rb
volt-0.8.22.beta1 lib/volt/reactive/hash_dependency.rb
volt-0.8.21 lib/volt/reactive/hash_dependency.rb
volt-0.8.20 lib/volt/reactive/hash_dependency.rb
volt-0.8.19 lib/volt/reactive/hash_dependency.rb