Module: MmDirtier::OneProxyListener
- Includes:
- Observables::Base
- Defined in:
- lib/mm_dirtier/one_proxy_listener.rb
Instance Method Summary collapse
- #changes_for(change_type, trigger_method, *args, &block) ⇒ Object
- #dup ⇒ Object
- #replace(val) ⇒ Object
Instance Method Details
#changes_for(change_type, trigger_method, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/mm_dirtier/one_proxy_listener.rb', line 11 def changes_for(change_type, trigger_method, *args, &block) prev = target.nil? ? nil : target.dup if change_type == :added lambda {{:added=>args}} else lambda{{:removed=>[prev], :added=>args}} end end |
#dup ⇒ Object
20 21 22 |
# File 'lib/mm_dirtier/one_proxy_listener.rb', line 20 def dup target.dup end |
#replace(val) ⇒ Object
5 6 7 8 9 |
# File 'lib/mm_dirtier/one_proxy_listener.rb', line 5 def replace(val) change_type = target.nil? ? :modified : :added changes = changes_for(change_type,:replace,val) changing(change_type,:trigger=>:replace, :changes=>changes) {super} end |