Sha256: fbf9ae91e6174b26b138f5a25b54e6256cc3f147031a53a305a70b5b5e313f83

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

require "slack_bot/events/configuration"
require "slack_bot/events/client"
require "slack_bot/events/schemas/socket_payload"

module SlackBot
  module Events
    class Error < StandardError; end

    def self.configure
      yield configuration if block_given?
    end

    def self.configuration
      @configuration ||= SlackBot::Events::Configuration.new
    end

    def self.config
      configuration
    end

    def self.configuration=(object)
      if SlackBot::Events::Configuration === obj
        @configuration = object
        return @configuration
      end

      raise Error, "Expected configuration to be a SlackBot::Events::Configuration"
    end

    def self.register_listener(name:, handler:)
      config.register_listener(name: name, handler: handler)
    end

    def self.remove_listener(name:)
      config.remove_listener(name: name)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack_bot-events-0.0.4 lib/slack_bot/events.rb
slack_bot-events-0.0.3 lib/slack_bot/events.rb
slack_bot-events-0.0.2 lib/slack_bot/events.rb