Module: AMQ::Client::Async::Callbacks

### Home Classes Methods

### In Files

- lib/amq/client/async/callbacks.rb

### Methods

- #append_callback
- #clear_callbacks
- #define_callback
- #exec_callback
- #exec_callback_once
- #exec_callback_once_yielding_self
- #exec_callback_yielding_self
- #has_callback?
- #prepend_callback
- #redefine_callback

### Class/Module Index

Quicksearch

- AMQ
- AMQ::Client
- AMQ::Client::Async
- AMQ::Client::Async::Adapter
- AMQ::Client::Async::Adapter::ClassMethods
- AMQ::Client::Async::AuthMechanismAdapter
- AMQ::Client::Async::AuthMechanismAdapter::External
- AMQ::Client::Async::AuthMechanismAdapter::Plain
- AMQ::Client::Async::Callbacks
- AMQ::Client::Async::Channel
- AMQ::Client::Async::Consumer
- AMQ::Client::Async::CoolioClient
- AMQ::Client::Async::CoolioClient::Socket
- AMQ::Client::Async::Entity
- AMQ::Client::Async::EventMachineClient
- AMQ::Client::Async::Exchange
- AMQ::Client::Async::Extensions
- AMQ::Client::Async::Extensions::RabbitMQ
- AMQ::Client::Async::Extensions::RabbitMQ::Basic
- AMQ::Client::Async::Extensions::RabbitMQ::Basic::ChannelMixin
- AMQ::Client::Async::Extensions::RabbitMQ::Basic::ConsumerMixin
- AMQ::Client::Async::Extensions::RabbitMQ::Basic::QueueMixin
- AMQ::Client::Async::Extensions::RabbitMQ::Confirm
- AMQ::Client::Async::Extensions::RabbitMQ::Confirm::ChannelMixin
- AMQ::Client::Async::ProtocolMethodHandlers
- AMQ::Client::Async::Queue
- AMQ::Client::Async::RegisterEntityMixin
- AMQ::Client::BadLengthError
- AMQ::Client::ConnectionClosedError
- AMQ::Client::ConsumerTagGenerator
- AMQ::Client::Framing
- AMQ::Client::Framing::IO
- AMQ::Client::Framing::IO::Frame
- AMQ::Client::Framing::String
- AMQ::Client::Framing::String::Frame
- AMQ::Client::HandlersRegistry
- AMQ::Client::InconsistentDataError
- AMQ::Client::Logging
- AMQ::Client::Logging::IncompatibleLoggerError
- AMQ::Client::MissingHandlerError
- AMQ::Client::NoFinalOctetError
- AMQ::Client::Openable
- AMQ::Client::Openable::ImproperStatusError
- AMQ::Client::PossibleAuthenticationFailureError
- AMQ::Client::ServerNamedEntity
- AMQ::Client::Settings
- AMQ::Client::TCPConnectionFailed
- AMQ::Client::UnknownExchangeTypeError
- AMQ::Protocol
- AMQ::Protocol::GetResponse

No matching classes.

# AMQ::Client::Async::Callbacks

### Public Instance Methods

append_callback(event, callable = nil, &block) click to toggle source
Alias for: define_callback
clear_callbacks(event) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 32
    def clear_callbacks(event)
      @callbacks[event].clear if @callbacks[event]
    end

define_callback(event, callable = nil, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 15
    def define_callback(event, callable = nil, &block)
      f = (callable || block)

      @callbacks[event] ||= []
      @callbacks[event] << f if f

      self
    end

Also aliased as: append_callback
exec_callback(name, *args, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 37
    def exec_callback(name, *args, &block)
      list = Array(@callbacks[name])
      if list.any?
        list.each { |c| c.call(*args, &block) }
      end
    end

exec_callback_once(name, *args, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 44
    def exec_callback_once(name, *args, &block)
      list = (@callbacks.delete(name) || Array.new)
      if list.any?
        list.each { |c| c.call(*args, &block) }
      end
    end

exec_callback_once_yielding_self(name, *args, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 58
    def exec_callback_once_yielding_self(name, *args, &block)
      list = (@callbacks.delete(name) || Array.new)

      if list.any?
        list.each { |c| c.call(self, *args, &block) }
      end
    end

exec_callback_yielding_self(name, *args, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 51
    def exec_callback_yielding_self(name, *args, &block)
      list = Array(@callbacks[name])
      if list.any?
        list.each { |c| c.call(self, *args, &block) }
      end
    end

has_callback?(name) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 66
    def has_callback?(name)
      @callbacks[name] && !@callbacks[name].empty?
    end

prepend_callback(event, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 25
    def prepend_callback(event, &block)
      @callbacks[event] ||= []
      @callbacks[event].unshift(block)

      self
    end

redefine_callback(event, callable = nil, &block) click to toggle source

    # File lib/amq/client/async/callbacks.rb, line 7
    def redefine_callback(event, callable = nil, &block)
      f = (callable || block)
      # yes, re-assign!
      @callbacks[event] = [f]

      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.