Method: Cinch::Handler#call
- Defined in:
- lib/cinch/handler.rb
#call(message, captures, arguments) ⇒ Thread
Executes the handler.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/cinch/handler.rb', line 89 def call(, captures, arguments) = captures + arguments thread = Thread.new { @bot.loggers.debug "[New thread] For #{self}: #{Thread.current} -- #{@thread_group.list.size} in total." begin if @execute_in_callback @bot.callback.instance_exec(, *@args, *, &@block) else @block.call(, *@args, *) end rescue => e @bot.loggers.exception(e) ensure @bot.loggers.debug "[Thread done] For #{self}: #{Thread.current} -- #{@thread_group.list.size - 1} remaining." end } @thread_group.add(thread) thread end |