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

ruby-concurrency / concurrent-ruby / #2937

05 Oct 2014 10:16PM UTC coverage: 90.686% (-4.1%) from 94.81%
#2937

push

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

Promise composition

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

145 existing lines in 16 files now uncovered.

2775 of 3060 relevant lines covered (90.69%)

316.23 hits per line

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

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

5
      # Links the actor to other actors and sends actor's events to them,
6
      # like: `:terminated`, `:paused`, errors, etc
7
      # TODO example
8
      class Linking < Abstract
1✔
9
        def initialize(core, subsequent)
1✔
10
          super core, subsequent
248✔
11
          @linked = Set.new
248✔
12
        end
13

14
        def on_envelope(envelope)
1✔
15
          case envelope.message
688✔
16
          when :link
17
            link envelope.sender
2✔
18
          when :unlink
19
            unlink envelope.sender
×
20
          when :linked?
UNCOV
21
            @linked.include? envelope.sender
×
22
          else
23
            pass envelope
686✔
24
          end
25
        end
26

27
        def link(ref)
1✔
28
          @linked.add(ref)
6✔
29
          true
6✔
30
        end
31

32
        def unlink(ref)
1✔
33
          @linked.delete(ref)
×
34
          true
×
35
        end
36

37
        def on_event(event)
1✔
38
          @linked.each { |a| a << event }
261✔
39
          @linked.clear if event == :terminated
250✔
40
          super event
250✔
41
        end
42
      end
43
    end
44
  end
45
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