Skip to content

Commit 1902327

Browse files
committed
Track usage by strategy
1 parent 3994bce commit 1902327

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/graphql/schema/field/default_resolver_tracker.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ class Schema
55
class Field
66
class DefaultResolverTracker
77
attr_reader :counts_by_field
8+
attr_reader :strategy_by_field
89

910
def initialize
1011
@counts_by_field = Hash.new do |h, k|
1112
h[k] = Hash.new do |h2, k2|
1213
h2[k2] = 0
1314
end
1415
end
16+
@strategy_by_field = Hash.new do |h, k|
17+
h[k] = Set.new
18+
end
1519
end
1620

1721
def track(field, strategy)
1822
@counts_by_field[field.path][strategy] += 1
23+
@strategy_by_field[strategy] << field.path
1924
end
2025
end
2126
end

0 commit comments

Comments
 (0)