Module: Celluloid::InstanceMethods

### Home Classes Methods

### In Files

- lib/celluloid.rb

### Methods

- #bare_object
- #inspect
- #leaked?
- #name
- #registered_name
- #tap
- #wrapped_object

### 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::InstanceMethods

These are methods we don't want added to the Celluloid singleton but to be defined on all classes that use Celluloid

### Public Instance Methods

bare_object() click to toggle source

Obtain the bare Ruby object the actor is wrapping. This is useful for only a limited set of use cases like runtime metaprogramming. Interacting directly with the bare object foregoes any kind of thread safety that Celluloid would ordinarily provide you, and the object is guaranteed to be shared with at least the actor thread. Tread carefully.

Bare objects can be identified via inspect output:

    >> actor
     => #<Celluloid::Actor(Foo:0x3fefcb77c194)>
    >> actor.bare_object
     => #<WARNING: BARE CELLULOID OBJECT (Foo:0x3fefcb77c194)>

    # File lib/celluloid.rb, line 262
    def bare_object; self; end

Also aliased as: wrapped_object
inspect() click to toggle source

    # File lib/celluloid.rb, line 281
    def inspect
      return "..." if Celluloid.detect_recursion

      str = "#<"

      if leaked?
        str << Celluloid::BARE_OBJECT_WARNING_MESSAGE
      else
        str << "Celluloid::CellProxy"
      end

      str << "(#{self.class}:0x#{object_id.to_s(16)})"
      str << " " unless instance_variables.empty?

      instance_variables.each do |ivar|
        next if ivar == Celluloid::OWNER_IVAR
        str << "#{ivar}=#{instance_variable_get(ivar).inspect} "
      end

      str.sub!(/\s$/, '>')
    end

leaked?() click to toggle source

Are we being invoked in a different thread from our owner?

    # File lib/celluloid.rb, line 266
    def leaked?
      @celluloid_owner != Thread.current[:celluloid_actor]
    end

name() click to toggle source
Alias for: registered_name
registered_name() click to toggle source

Obtain the name of the current actor

    # File lib/celluloid.rb, line 276
    def registered_name
      Actor.registered_name
    end

Also aliased as: name
tap() click to toggle source

    # File lib/celluloid.rb, line 270
    def tap
      yield current_actor
      current_actor
    end

wrapped_object() click to toggle source
Alias for: bare_object

[Validate]

Generated with the Darkfish Rdoc Generator 2.