File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ def dispose
72
72
@contexts . dispose ( @id )
73
73
end
74
74
75
+ def has_target? ( target_id )
76
+ @targets . keys . include? ( target_id )
77
+ end
78
+
75
79
def inspect
76
80
%(#<#{ self . class } @id=#{ @id . inspect } @targets=#{ @targets . inspect } @default_target=#{ @default_target . inspect } >)
77
81
end
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class Contexts
7
7
attr_reader :contexts
8
8
9
9
def initialize ( browser )
10
- @contexts = Concurrent ::Hash . new
10
+ @contexts = Concurrent ::Map . new
11
11
@browser = browser
12
12
subscribe
13
13
discover
@@ -18,7 +18,9 @@ def default_context
18
18
end
19
19
20
20
def find_by ( target_id :)
21
- @contexts . find { |_ , c | c . targets . keys . include? ( target_id ) } &.last
21
+ context = nil
22
+ @contexts . each_value { |c | context = c if c . has_target? ( target_id ) }
23
+ context
22
24
end
23
25
24
26
def create
You can’t perform that action at this time.
0 commit comments