Method: Cinch::HandlerList#find
- Defined in:
- lib/cinch/handler_list.rb
#find(type, msg = nil) ⇒ Array<Handler>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cinch/handler_list.rb', line 35 def find(type, msg = nil) if handlers = @handlers[type] if msg.nil? return handlers end handlers = handlers.select { |handler| msg.match(handler.pattern.to_r(msg), type, handler.strip_colors) }.group_by {|handler| handler.group} handlers.values_at(*(handlers.keys - [nil])).map(&:first) + (handlers[nil] || []) end end |