lib/lita/handler/chat_router.rb in lita-4.0.4 vs lib/lita/handler/chat_router.rb in lita-4.1.0

- old
+ new

@@ -39,15 +39,15 @@ # @param help [Hash] An optional map of example invocations to descriptions. # @param options [Hash] Aribtrary additional data that can be used by Lita extensions. # @yield The body of the route's callback. # @return [void] # @since 4.0.0 - def route(pattern, method_name = nil, **options) + def route(pattern, method_name = nil, **options, &block) options = default_route_options.merge(options) options[:restrict_to] = options[:restrict_to].nil? ? nil : Array(options[:restrict_to]) routes << Route.new( pattern, - Callback.new(method_name || (proc if block_given?)), + Callback.new(method_name || block), options.delete(:command), options.delete(:restrict_to), options.delete(:help), options )