File: block.rb

package info (click to toggle)
ruby-celluloid 0.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: ruby: 7,579; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 507 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Celluloid
  class Call
    class Block
      def initialize(block_proxy, sender, arguments, task = Thread.current[:celluloid_task])
        @block_proxy = block_proxy
        @sender = sender
        @arguments = arguments
        @task = task
      end
      attr_reader :task

      def call
        @block_proxy.call
      end

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