Method: WeChat::Bot::Handler#initialize

Defined in:
lib/wechat/bot/handler.rb

#initialize(bot, event, pattern, options = {}, &block) ⇒ Handler

Returns a new instance of Handler.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/wechat/bot/handler.rb', line 26

def initialize(bot, event, pattern, options = {}, &block)
  options              = {
    :group => nil,
    :execute_in_callback => false,
    :strip_colors => false,
    :args => []
  }.merge(options)

  @bot = bot
  @event = event
  @pattern = pattern
  @block = block
  @group = options[:group]
  @execute_in_callback = options[:execute_in_callback]
  @args = options[:args]

  @thread_group = ThreadGroup.new
end