Class: Glimmer::DataBinding::Observer::Proc

Inherits:
Object
  • Object
show all
Includes:
Glimmer::DataBinding::Observer
Defined in:
lib/glimmer/data_binding/observer.rb

Overview

Observer Proc default implementation that takes an observer block to process updates via call method

Instance Method Summary collapse

Methods included from Glimmer::DataBinding::Observer

#add_dependent, #compact_args, #dependents, #dependents_for, #observe, proc, #registration_for, #registrations, #remove_dependent, #unobserve, #unobserve_all_observables, #unobserve_dependents_with_observable

Constructor Details

#initialize(&observer_block) ⇒ Proc

Returns a new instance of Proc.


39
40
41
# File 'lib/glimmer/data_binding/observer.rb', line 39

def initialize(&observer_block)
  @observer_block = observer_block
end

Instance Method Details

#call(new_value = nil, *extra_args) ⇒ Object

Called by observables once updates occur sending in the new_value if any


44
45
46
# File 'lib/glimmer/data_binding/observer.rb', line 44

def call(new_value=nil, *extra_args)
  @observer_block.call(new_value, *extra_args)
end