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

ruby-concurrency / concurrent-ruby / #2835

05 Oct 2014 10:16PM UTC coverage: 45.201% (-49.6%) from 94.81%
#2835

push

jdantonio
Merge pull request #158 from obrok/promise-composition

Promise composition

2 of 15 new or added lines in 1 file covered. (13.33%)

1514 existing lines in 84 files now uncovered.

1375 of 3042 relevant lines covered (45.2%)

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. Messages:
7
      # `:pause!, :resume!, :reset!, :restart!` are accepted only from supervisor.
8
      class Supervised < Abstract
1✔
9
        attr_reader :supervisor
1✔
10

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

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

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

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

52
        def on_event(event)
1✔
UNCOV
53
          @supervisor = nil if event == :terminated
×
UNCOV
54
          super event
×
55
        end
56
      end
57
    end
58
  end
59
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