Method: Tribe::Actable#spawn

Defined in:
lib/tribe/actable.rb

#spawn(klass, actor_options = {}, spawn_options = {}) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/tribe/actable.rb', line 79

def spawn(klass, actor_options = {}, spawn_options = {})
  actor_options[:parent] = self

  @_as.children ||= []
  child = nil

  if spawn_options[:no_raise_on_failure]
    begin
      child = klass.new(actor_options)
    rescue Exception => e
      return false
    end
  else
    child = klass.new(actor_options)
  end

  @_as.children << child

  return child
end