• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-concurrency / concurrent-ruby / #2938

11 Aug 2014 02:52PM UTC coverage: 45.217% (-45.4%) from 90.621%
#2938

push

jdantonio
Removed Rbx from Travis allowed failures list.

1366 of 3021 relevant lines covered (45.22%)

0.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/lib/concurrent/actor/behaviour/supervised.rb
1
module Concurrent
1✔
2
  module Actor
1✔
3
    module Behaviour
1✔
4

5
      # Sets and holds the supervisor of the actor if any. There is at most one supervisor
6
      # for each actor. Each supervisor is automatically linked.
7
      class Supervised < Abstract
1✔
8
        attr_reader :supervisor
1✔
9

10
        def initialize(core, subsequent)
1✔
11
          super core, subsequent
×
12
          @supervisor = nil
×
13
        end
14

15
        def on_envelope(envelope)
1✔
16
          case envelope.message
×
17
          when :supervise
18
            supervise envelope.sender
×
19
          when :supervisor
20
            supervisor
×
21
          when :un_supervise
22
            un_supervise envelope.sender
×
23
          when :pause!, :resume!, :reset!, :restart!
24
            # allow only supervisor to control the actor
25
            if @supervisor == envelope.sender
×
26
              pass envelope
×
27
            else
28
              false
×
29
            end
30
          else
31
            pass envelope
×
32
          end
33
        end
34

35
        def supervise(ref)
1✔
36
          @supervisor = ref
×
37
          behaviour!(Linking).link ref
×
38
          true
×
39
        end
40

41
        def un_supervise(ref)
1✔
42
          if @supervisor == ref
×
43
            behaviour!(Linking).unlink ref
×
44
            @supervisor = nil
×
45
            true
×
46
          else
47
            false
×
48
          end
49
        end
50

51
        def on_event(event)
1✔
52
          @supervisor = nil if event == :terminated
×
53
          super event
×
54
        end
55
      end
56
    end
57
  end
58
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc