Module: Wonkavision::Plugins::EventHandling::InstanceMethods
- Defined in:
- lib/wonkavision/plugins/event_handling.rb
Instance Method Summary collapse
Instance Method Details
#event_context ⇒ Object
69 70 71 |
# File 'lib/wonkavision/plugins/event_handling.rb', line 69 def event_context @wonkavision_event_context end |
#handle_event ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/wonkavision/plugins/event_handling.rb', line 73 def handle_event ctx = @wonkavision_event_context ctx.data = map(ctx.data,ctx.path) handler = ctx.callback if handler && handler.respond_to?(:call) && handler.respond_to?(:arity) case handler.arity when 3 then handler.call(ctx.data,ctx.path,self) when 2 then handler.call(ctx.data,ctx.path) when 1 then handler.call(ctx.data) else instance_eval &handler end end end |
#handled=(handled) ⇒ Object
65 66 67 |
# File 'lib/wonkavision/plugins/event_handling.rb', line 65 def handled=(handled) @wonkavision_event_handled = handled end |
#handled? ⇒ Boolean
61 62 63 |
# File 'lib/wonkavision/plugins/event_handling.rb', line 61 def handled? @wonkavision_event_handled ||= false end |