Sha256: 8402c545ebe21049116641f9fd797080706246ccff961b60e85e663a9d36320a

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

class AsyncListener
  include Celluloid if defined?(Celluloid)

  attr_reader :listener, :event_method

  def initialize(listener, event_method)
    @listener     = listener
    @event_method = event_method.to_sym
  end

  def method_missing(method, *args, &block)
    if listener.respond_to?(method)
      if method == event_method
        listener.public_send(method, *args, &block)
        terminate
      else
        listener.public_send(method, *args, &block)
      end
    else
      super(method, *args, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wisper-1.0.1 lib/wisper/registration/object/async_listener.rb