Class: Celluloid::Call::Block

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_proxy, sender, arguments, task = Thread.current[:celluloid_task]) ⇒ Block

Returns a new instance of Block.



4
5
6
7
8
9
# File 'lib/celluloid/call/block.rb', line 4

def initialize(block_proxy, sender, arguments, task = Thread.current[:celluloid_task])
  @block_proxy = block_proxy
  @sender = sender
  @arguments = arguments
  @task = task
end

Instance Attribute Details

#taskObject (readonly)

Returns the value of attribute task.



10
11
12
# File 'lib/celluloid/call/block.rb', line 10

def task
  @task
end

Instance Method Details

#callObject



12
13
14
# File 'lib/celluloid/call/block.rb', line 12

def call
  @block_proxy.call
end

#dispatchObject



16
17
18
19
# File 'lib/celluloid/call/block.rb', line 16

def dispatch
  response = @block_proxy.block.call(*@arguments)
  @sender << Internals::Response::Block.new(self, response)
end