lib/resugan/object.rb in resugan-0.1.1 vs lib/resugan/object.rb in resugan-0.1.2

- old
+ new

@@ -13,6 +13,12 @@ current_thread = Thread.current if current_thread.resugan_context current_thread.resugan_context.register(event, params) end end + + def listener(event, options = {}, &block) + Resugan::Kernel.register_with_namespace(options[:namespace], event, options[:id], ->(params) { + block.call(params) + }) + end end