Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.

Commit 3c3f378

Browse files
Refactor for shorter parameter lists
1 parent 4d544aa commit 3c3f378

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

lib/graphql/cache/fetcher.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def cached_resolve(type, field)
3838
old_resolve_proc.call(obj, args, ctx)
3939
end
4040

41-
wrap_connections(value, args, field, obj, ctx)
41+
wrap_connections(value, args, field: field, parent: obj, context: ctx)
4242
end
4343
end
4444

4545
# @private
46-
def wrap_connections(value, args, field, obj, ctx)
46+
def wrap_connections(value, args, **kwargs)
4747
# return raw value if field isn't a connection (no need to wrap)
48-
return value unless field.connection?
48+
return value unless kwargs[:field].connection?
4949

5050
# return cached value if it is already a connection object
5151
# this occurs when the value is being resolved by GraphQL
@@ -54,17 +54,17 @@ def wrap_connections(value, args, field, obj, ctx)
5454
GraphQL::Relay::BaseConnection
5555
)
5656

57-
create_connection(value, args, field, obj, ctx)
57+
create_connection(value, args, **kwargs)
5858
end
5959

6060
# @private
61-
def create_connection(value, args, field, obj, ctx)
61+
def create_connection(value, args, **kwargs)
6262
GraphQL::Relay::BaseConnection.connection_for_nodes(value).new(
6363
value,
6464
args,
65-
field: field,
66-
parent: obj,
67-
context: ctx
65+
field: kwargs[:field],
66+
parent: kwargs[:parent],
67+
context: kwargs[:context]
6868
)
6969
end
7070
end

0 commit comments

Comments
 (0)