Class: Botkit::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/botkit/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bot, polling: 1) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
# File 'lib/botkit/runner.rb', line 7

def initialize(bot, polling: 1)
  @bot = bot
  @polling = polling
end

Instance Attribute Details

#botObject (readonly)

Returns the value of attribute bot.



5
6
7
# File 'lib/botkit/runner.rb', line 5

def bot
  @bot
end

#pollingObject (readonly)

Returns the value of attribute polling.



5
6
7
# File 'lib/botkit/runner.rb', line 5

def polling
  @polling
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'lib/botkit/runner.rb', line 12

def call
  loop do
    tick

    break if bot.halt?

    sleep(polling)
  end
end