Module: Celluloid::ClassMethods
- Defined in:
- lib/celluloid.rb
Overview
Class methods added to classes which include Celluloid
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#actor_options ⇒ Object
Configuration options for Actor#new.
- #actor_system ⇒ Object
- #behavior_options ⇒ Object
- #new(*args, &block) ⇒ Object (also: #spawn)
-
#new_link(*args, &block) ⇒ Object
(also: #spawn_link)
Create a new actor and link to the current one.
-
#run(*args, &block) ⇒ Object
Run an actor in the foreground.
Instance Method Details
#===(other) ⇒ Object
242 243 244 |
# File 'lib/celluloid.rb', line 242 def ===(other) other.is_a? self end |
#actor_options ⇒ Object
Configuration options for Actor#new
222 223 224 225 226 227 228 229 230 |
# File 'lib/celluloid.rb', line 222 def { actor_system: actor_system, mailbox_class: mailbox_class, mailbox_size: mailbox_size, task_class: task_class, exclusive: exclusive_actor, } end |
#actor_system ⇒ Object
217 218 219 |
# File 'lib/celluloid.rb', line 217 def actor_system Celluloid.actor_system end |
#behavior_options ⇒ Object
232 233 234 235 236 237 238 239 240 |
# File 'lib/celluloid.rb', line 232 def { proxy_class: proxy_class, exclusive_methods: exclusive_methods, exit_handler_name: exit_handler_name, finalizer: finalizer, receiver_block_executions: execute_block_on_receiver, } end |
#new(*args, &block) ⇒ Object Also known as: spawn
194 195 196 197 198 |
# File 'lib/celluloid.rb', line 194 def new(*args, &block) proxy = Cell.new(allocate, , ).proxy proxy._send_(:initialize, *args, &block) proxy end |
#new_link(*args, &block) ⇒ Object Also known as: spawn_link
Create a new actor and link to the current one
202 203 204 205 206 207 208 209 |
# File 'lib/celluloid.rb', line 202 def new_link(*args, &block) fail NotActorError, "can't link outside actor context" unless Celluloid.actor? proxy = Cell.new(allocate, , ).proxy Actor.link(proxy) proxy._send_(:initialize, *args, &block) proxy end |