Sha256: b0cac813778a5bc3cdd8de6f9458a1202e9cc1ef62ebd5e86a298279fb981915

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 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 => exception
      bot.report_exception(exception)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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