Sha256: 3b9b0b29bb0eaa618747cc1668fcc733c89361a340ae8534673afa4553994c6f

Contents?: true

Size: 412 Bytes

Versions: 1

Compression:

Stored size: 412 Bytes

Contents

# frozen_string_literal: true

module Botkit
  class Runner
    attr_reader :bot, :polling

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

    def call
      loop do
        tick

        break if bot.halt?

        sleep(polling)
      end
    end

    private def tick
      bot.call
    rescue StandardError => error
      bot.report_exception(error)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
botkit-0.0.6 lib/botkit/runner.rb