Sha256: 4867ed9b03f81b638c74537af339f53691e270afbdc95d24b0d2f24fc240d359

Contents?: true

Size: 559 Bytes

Versions: 8

Compression:

Stored size: 559 Bytes

Contents

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)
    # TODORW: should this .remove
    dep = @hash_depedencies[key]

    if dep
      dep.changed!
      dep.remove
    end

    @hash_depedencies.delete(key)
  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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
volt-0.8.7 lib/volt/reactive/hash_dependency.rb
volt-0.8.6 lib/volt/reactive/hash_dependency.rb
volt-0.8.5 lib/volt/reactive/hash_dependency.rb
volt-0.8.4 lib/volt/reactive/hash_dependency.rb
volt-0.8.3 lib/volt/reactive/hash_dependency.rb
volt-0.8.2 lib/volt/reactive/hash_dependency.rb
volt-0.8.1 lib/volt/reactive/hash_dependency.rb
volt-0.8.0 lib/volt/reactive/hash_dependency.rb