File: internal_delegations.rb

package info (click to toggle)
ruby-concurrent 1.1.6%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 30,284 kB
  • sloc: ruby: 30,875; java: 6,117; javascript: 1,114; ansic: 288; makefile: 10; sh: 6
file content (60 lines) | stat: -rw-r--r-- 1,371 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module Concurrent
  module Actor
    module InternalDelegations
      include PublicDelegations
      include Logger::Severity

      # @see Core#children
      def children
        core.children
      end

      # @see Termination#terminate!
      def terminate!(reason = nil)
        behaviour!(Behaviour::Termination).terminate!(reason)
      end

      # @see Termination#terminated?
      def terminated?
        behaviour!(Behaviour::Termination).terminated?
      end

      # # @see Termination#reason
      # def reason
      #   behaviour!(Behaviour::Termination).reason
      # end

      # delegates to core.log
      # @see Logging#log
      def log(level, message = nil, &block)
        core.log(level, message, &block)
      end

      # @see AbstractContext#dead_letter_routing
      def dead_letter_routing
        context.dead_letter_routing
      end

      def redirect(reference, envelope = self.envelope)
        reference.message(envelope.message, envelope.future)
        Behaviour::MESSAGE_PROCESSED
      end

      # @return [AbstractContext]
      def context
        core.context
      end

      # see Core#behaviour
      def behaviour(behaviour_class)
        core.behaviour(behaviour_class)
      end

      # see Core#behaviour!
      def behaviour!(behaviour_class)
        core.behaviour!(behaviour_class)
      end

    end
  end
end