Module: Actor::Module::Start

Defined in:
lib/actor/module/start.rb

Instance Method Summary collapse

Instance Method Details

#start(*arguments, include: nil, **keyword_arguments, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/actor/module/start.rb', line 4

def start *arguments, include: nil, **keyword_arguments, &block
  arguments << keyword_arguments if keyword_arguments.any?

  actor, thread = Actor::Start.(self, *arguments, &block)

  address = actor.address

  if include
    return_values = [address]

    Array(include).each do |label|
      argument = { :thread => thread, :actor => actor }.fetch label

      return_values << argument
    end

    return return_values
  else
    return address
  end
end