Sha256: 0543e555d6e5c5cead56c1b6b29bf7a7d09040c3e8ae1ef5a99490312ddc529d

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

require "active_support/core_ext/hash"
module Octogate
  module Event
    class << self
      def register_event(name, klass)
        @events ||= {}.with_indifferent_access
        @events[name] = klass
      end

      def get(name)
        @events.fetch(name) do
          raise NotRegisteredEvent.new(name)
        end
      end
    end
  end

  class NotRegisteredEvent < StandardError; end
end

require "octogate/events/push"
require "octogate/events/pull_request"
require "octogate/events/issue"
require "octogate/events/issue_comment"
require "octogate/events/pull_request_review_comment"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
octogate-0.4.0 lib/octogate/events.rb
octogate-0.3.0 lib/octogate/events.rb
octogate-0.2.2 lib/octogate/events.rb