Method: GraphQL::Client::QueryTypename.node_flatten_selections

Defined in:
lib/graphql/client/query_typename.rb

.node_flatten_selections(selections) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/graphql/client/query_typename.rb', line 45

def self.node_flatten_selections(selections)
  selections.flat_map do |selection|
    case selection
    when GraphQL::Language::Nodes::Field
      selection
    when GraphQL::Language::Nodes::InlineFragment
      node_flatten_selections(selection.selections)
    else
      []
    end
  end
end