Class: GraphQL::SmartSelect::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/smart_select/resolver.rb

Overview

Resolve the minimum required fields for the query

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation, ctx, smart_select) ⇒ Resolver

Returns a new instance of Resolver.



14
15
16
17
18
# File 'lib/graphql/smart_select/resolver.rb', line 14

def initialize(relation, ctx, smart_select)
  @smart_select = smart_select
  @relation = relation
  @ctx = ctx
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



12
13
14
# File 'lib/graphql/smart_select/resolver.rb', line 12

def ctx
  @ctx
end

#relationObject (readonly)

Returns the value of attribute relation.



12
13
14
# File 'lib/graphql/smart_select/resolver.rb', line 12

def relation
  @relation
end

#smart_selectObject (readonly)

Returns the value of attribute smart_select.



12
13
14
# File 'lib/graphql/smart_select/resolver.rb', line 12

def smart_select
  @smart_select
end

Instance Method Details

#resolveObject



20
21
22
23
24
25
26
# File 'lib/graphql/smart_select/resolver.rb', line 20

def resolve
  reject_virtual_fields(
    query_fields |
      Assosiations.new(relation, query_fields).expose |
      Options.new(list_of_nodes, smart_select).expose
  ).map(&:to_sym)
end