Sha256: 06760a9c82786b1e1eb3cd3e1ba82d9fc160d08752ca7f0adda1e909fc36347e
Contents?: true
Size: 751 Bytes
Versions: 3
Compression:
Stored size: 751 Bytes
Contents
# frozen_string_literal: true require 'active_support/core_ext/class/attribute' module RabbitmqClient # Custom Error thrown in case of defining a plugin without any callbacks class EmptyPlugin < RuntimeError def initialize(name) super("The Plugin '#{name}' is empty") end end # Plugin class is the base class for all Plugins that # extends RabbitmqClient functionalty. class Plugin def initialize callback_block.call(RabbitmqClient.lifecycle) end def callback_block klass = self.class klass.callback_block || (raise EmptyPlugin, klass.to_s) end class << self attr_accessor :callback_block def callbacks(&block) @callback_block = block end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rabbitmq_client-0.0.3 | lib/rabbitmq_client/plugin.rb |
rabbitmq_client-0.0.2 | lib/rabbitmq_client/plugin.rb |
rabbitmq_client-0.0.1 | lib/rabbitmq_client/plugin.rb |