Module: AMQP::RegisterEntityMixin

Included in:
Channel, Session
Defined in:
lib/amqp/entity.rb

Instance Method Summary collapse

Instance Method Details

#register_entity(name, klass) ⇒ Object

Examples:

Registering Channel implementation

Adapter.register_entity(:channel, Channel)
 # ... so then I can do:
channel = client.channel(1)
# instead of:
channel = Channel.new(client, 1)


12
13
14
15
16
# File 'lib/amqp/entity.rb', line 12

def register_entity(name, klass)
  define_method(name) do |*args, &block|
    klass.new(self, *args, &block)
  end # define_method
end