Method: GraphitiGql::ResourceExtras#selections

Defined in:
lib/graphiti_gql/graphiti_hax.rb

#selectionsObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/graphiti_gql/graphiti_hax.rb', line 46

def selections
  return @selections if @selections
  lookahead = context[:current_arguments]
    .keyword_arguments[:lookahead]
  nodes = lookahead.selection(:nodes)
  if !nodes.selected?
    nodes = lookahead
      .selection(:edges)
      .selection(:node)
  end

  if !nodes.selected?
    nodes = lookahead
  end

  @selections = nodes
    .selections
    .map(&:name).map { |name| name.to_s.underscore.to_sym }
  @selections
end