Class: Volt::HashDependency
- Defined in:
- lib/volt/reactive/hash_dependency.rb
Instance Method Summary collapse
- #changed!(key) ⇒ Object
- #changed_all! ⇒ Object
- #delete(key) ⇒ Object
- #depend(key) ⇒ Object
-
#initialize ⇒ HashDependency
constructor
A new instance of HashDependency.
Constructor Details
#initialize ⇒ HashDependency
Returns a new instance of HashDependency.
3 4 5 |
# File 'lib/volt/reactive/hash_dependency.rb', line 3 def initialize @hash_depedencies = {} end |
Instance Method Details
#changed!(key) ⇒ Object
11 12 13 |
# File 'lib/volt/reactive/hash_dependency.rb', line 11 def changed!(key) ensure_key(key).changed! end |
#changed_all! ⇒ Object
24 25 26 27 28 |
# File 'lib/volt/reactive/hash_dependency.rb', line 24 def changed_all! @hash_depedencies.each_pair do |key, value| value.changed! end end |
#delete(key) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/volt/reactive/hash_dependency.rb', line 15 def delete(key) dep = @hash_depedencies.delete(key) if dep dep.changed! dep.remove end end |
#depend(key) ⇒ Object
7 8 9 |
# File 'lib/volt/reactive/hash_dependency.rb', line 7 def depend(key) ensure_key(key).depend end |