Parent

Methods

Class/Module Index [+]

Quicksearch

Celluloid::BlockProxy

Attributes

block[R]
call[R]
execution[W]

Public Class Methods

new(call, mailbox, block) click to toggle source
# File lib/celluloid/proxies/block_proxy.rb, line 3
def initialize(call, mailbox, block)
  @call = call
  @mailbox = mailbox
  @block = block
  @execution = :sender
end

Public Instance Methods

to_proc() click to toggle source
# File lib/celluloid/proxies/block_proxy.rb, line 12
def to_proc
  if @execution == :sender
    lambda do |*values|
      if task = Thread.current[:celluloid_task]
        @mailbox << BlockCall.new(self, Actor.current.mailbox, values)
        # TODO: if respond fails, the Task will never be resumed
        task.suspend(:invokeblock)
      else
        # FIXME: better exception
        raise "No task to suspend"
      end
    end
  else
    @block
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.