lib/lita/handler/event_router.rb in lita-4.0.4 vs lib/lita/handler/event_router.rb in lita-4.1.0
- old
+ new
@@ -33,12 +33,12 @@
# handler instance, and passed a payload (a hash of arbitrary keys and values).
# @param event_name [String, Symbol] The name of the event to subscribe to.
# @yield The body of the event callback.
# @return [void]
# @since 4.0.0
- def on(event_name, method_name_or_callable = nil)
+ def on(event_name, method_name_or_callable = nil, &block)
event_subscriptions[normalize_event(event_name)] << Callback.new(
- method_name_or_callable || (proc if block_given?)
+ method_name_or_callable || block
)
end
# Returns an array of all callbacks registered for the named event.
# @param event_name [String, Symbol] The name of the event to return callbacks for.