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.



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

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.



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

def ctx
  @ctx
end

#relationObject (readonly)

Returns the value of attribute relation.



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

def relation
  @relation
end

#smart_selectObject (readonly)

Returns the value of attribute smart_select.



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

def smart_select
  @smart_select
end

Instance Method Details

#resolveObject



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

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