Class: Celluloid::Group::Member

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid/group.rb

Overview

A member of the group

Instance Method Summary collapse

Constructor Details

#initialize(klass, options = {}) ⇒ Member

Returns a new instance of Member.



74
75
76
77
78
79
80
81
82
# File 'lib/celluloid/group.rb', line 74

def initialize(klass, options = {})
  @klass = klass

  # Stringify keys :/
  options = options.inject({}) { |h,(k,v)| h[k.to_s] = v; h }

  @name = options['as']
  @args = options['args'] ? Array(options['args']) : []
end

Instance Method Details

#startObject



84
85
86
87
# File 'lib/celluloid/group.rb', line 84

def start
  actor = @klass.new_link(*@args)
  Actor[@name] = actor if @name
end