Module: Celluloid::ClassMethods

### Home Classes Methods

### In Files

- lib/celluloid.rb

### Methods

- #===
- #actor_options
- #actor_system
- #behavior_options
- #new
- #new_link
- #pool
- #pool_link
- #run
- #spawn
- #spawn_link
- #supervise
- #supervise_as

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::AbortError
- Celluloid::AbstractProxy
- Celluloid::Actor
- Celluloid::Actor::Sleeper
- Celluloid::ActorProxy
- Celluloid::ActorSystem
- Celluloid::AsyncCall
- Celluloid::AsyncProxy
- Celluloid::BlockCall
- Celluloid::BlockProxy
- Celluloid::BlockResponse
- Celluloid::CPUCounter
- Celluloid::Call
- Celluloid::CallChain
- Celluloid::Cell
- Celluloid::Cell::ExitHandler
- Celluloid::CellProxy
- Celluloid::ClassMethods
- Celluloid::Condition
- Celluloid::Condition::Waiter
- Celluloid::ConditionError
- Celluloid::DeadTaskError
- Celluloid::ErrorResponse
- Celluloid::EventedMailbox
- Celluloid::ExitEvent
- Celluloid::FSM
- Celluloid::FSM::ClassMethods
- Celluloid::FSM::State
- Celluloid::FSM::UnattachedError
- Celluloid::FiberStackError
- Celluloid::Future
- Celluloid::Future::Result
- Celluloid::FutureProxy
- Celluloid::Handler
- Celluloid::Handlers
- Celluloid::Incident
- Celluloid::IncidentLogger
- Celluloid::IncidentLogger::Severity
- Celluloid::IncidentReporter
- Celluloid::IncidentReporter::Formatter
- Celluloid::InstanceMethods
- Celluloid::InternalPool
- Celluloid::LinkingRequest
- Celluloid::LinkingResponse
- Celluloid::Links
- Celluloid::LogEvent
- Celluloid::Logger
- Celluloid::Logger::WithBacktrace
- Celluloid::Mailbox
- Celluloid::MailboxDead
- Celluloid::MailboxShutdown
- Celluloid::Method
- Celluloid::NamingRequest
- Celluloid::NotTaskError
- Celluloid::Notifications
- Celluloid::Notifications::Fanout
- Celluloid::Notifications::Subscriber
- Celluloid::PoolManager
- Celluloid::Probe
- Celluloid::Properties
- Celluloid::Receiver
- Celluloid::Receivers
- Celluloid::Registry
- Celluloid::Response
- Celluloid::ResumableError
- Celluloid::RingBuffer
- Celluloid::SignalConditionRequest
- Celluloid::Signals
- Celluloid::StackDump
- Celluloid::StackDump::ActorState
- Celluloid::StackDump::CellState
- Celluloid::StackDump::DisplayBacktrace
- Celluloid::StackDump::TaskState
- Celluloid::StackDump::ThreadState
- Celluloid::SuccessResponse
- Celluloid::SupervisionGroup
- Celluloid::SupervisionGroup::Member
- Celluloid::Supervisor
- Celluloid::SyncCall
- Celluloid::SyncProxy
- Celluloid::SystemEvent
- Celluloid::Task
- Celluloid::Task::TerminatedError
- Celluloid::Task::TimeoutError
- Celluloid::TaskFiber
- Celluloid::TaskSet
- Celluloid::TaskThread
- Celluloid::TerminationRequest
- Celluloid::Thread
- Celluloid::ThreadHandle
- Celluloid::UUID
- org
- org::jruby
- org::jruby::ext
- org::jruby::ext::fiber
- org::jruby::ext::fiber::ThreadFiber
- Bar
- Baz
- Blocker
- ExampleActorClass
- ExampleCrash
- ExampleMailbox
- ExampleProxy
- ExampleTask
- Fiber
- Foo
- MockActor
- Object
- Thread

No matching classes.

# Celluloid::ClassMethods

Class methods added to classes which include Celluloid

### Public Instance Methods

===(other) click to toggle source

    # File lib/celluloid.rb, line 241
    def ===(other)
      other.kind_of? self
    end

actor_options() click to toggle source

Configuration options for Actor#new

    # File lib/celluloid.rb, line 221
    def actor_options
      {
        :actor_system      => actor_system,
        :mailbox_class     => mailbox_class,
        :mailbox_size      => mailbox_size,
        :task_class        => task_class,
        :exclusive         => exclusive_actor,
      }
    end

actor_system() click to toggle source

    # File lib/celluloid.rb, line 216
    def actor_system
      Celluloid.actor_system
    end

behavior_options() click to toggle source

    # File lib/celluloid.rb, line 231
    def behavior_options
      {
        :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) click to toggle source

Create a new actor

    # File lib/celluloid.rb, line 167
    def new(*args, &block)
      proxy = Cell.new(allocate, behavior_options, actor_options).proxy
      proxy._send_(:initialize, *args, &block)
      proxy
    end

Also aliased as: spawn
new_link(*args, &block) click to toggle source

Create a new actor and link to the current one

    # File lib/celluloid.rb, line 175
    def new_link(*args, &block)
      raise NotActorError, "can't link outside actor context" unless Celluloid.actor?

      proxy = Cell.new(allocate, behavior_options, actor_options).proxy
      Actor.link(proxy)
      proxy._send_(:initialize, *args, &block)
      proxy
    end

Also aliased as: spawn_link
pool(options = {}) click to toggle source

Create a new pool of workers. Accepts the following options:

- size: how many workers to create. Default is worker per CPU core

- args: array of arguments to pass when creating a worker

    # File lib/celluloid.rb, line 202
    def pool(options = {})
      PoolManager.new(self, options)
    end

pool_link(options = {}) click to toggle source

Same as pool, but links to the pool manager

    # File lib/celluloid.rb, line 207
    def pool_link(options = {})
      PoolManager.new_link(self, options)
    end

run(*args, &block) click to toggle source

Run an actor in the foreground

    # File lib/celluloid.rb, line 212
    def run(*args, &block)
      Actor.join(new(*args, &block))
    end

spawn(*args, &block) click to toggle source
Alias for: new
spawn_link(*args, &block) click to toggle source
Alias for: new_link
supervise(*args, &block) click to toggle source

Create a supervisor which ensures an instance of an actor will restart an actor if it fails

    # File lib/celluloid.rb, line 187
    def supervise(*args, &block)
      Supervisor.supervise(self, *args, &block)
    end

supervise_as(name, *args, &block) click to toggle source

Create a supervisor which ensures an instance of an actor will restart an actor if it fails, and keep the actor registered under a given name

    # File lib/celluloid.rb, line 193
    def supervise_as(name, *args, &block)
      Supervisor.supervise_as(name, self, *args, &block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.