Module: Plumbing::Actor::ClassMethods

Defined in:
lib/plumbing/actor.rb

Instance Method Summary collapse

Instance Method Details

#async(*names) ⇒ Object

Define the async messages that this actor can respond to

Parameters:

  • names (Array<Symbol>)

    the names of the async messages



31
# File 'lib/plumbing/actor.rb', line 31

def async(*names) = async_messages.concat(names.map(&:to_sym))

#async_messagesObject

List the async messages that this actor can respond to



34
# File 'lib/plumbing/actor.rb', line 34

def async_messages = @async_messages ||= []

#inherited(subclass) ⇒ Object



36
37
38
# File 'lib/plumbing/actor.rb', line 36

def inherited subclass
  subclass.async_messages.concat async_messages
end

#startObject

Create a new actor instance and build a proxy for it using the current mode

Returns:

  • (Object)

    the proxy for the actor instance



22
23
24
25
26
27
# File 'lib/plumbing/actor.rb', line 22

def start(...)
  instance = new(...)
  build_proxy_for(instance).tap do |proxy|
    instance.send :"proxy=", proxy
  end
end