Method: Wonkavision::Plugins::EventHandling::ClassMethods#handle

Defined in:
lib/wonkavision/plugins/event_handling.rb

#handle(name, *args, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/wonkavision/plugins/event_handling.rb', line 37

def handle(name,*args,&block)
  binding = create_binding(name,self,*args)
  binding.subscribe_to_events do |event_data,event_path|
    ctx = Wonkavision::EventContext.new(event_data,event_path,binding,block)
    handler = instantiate_handler(ctx)
    handler.instance_variable_set(:@wonkavision_event_context, ctx)
    handler.handle_event
  end
  bindings << binding
  binding
end