module GraphQL::Client::QueryTypename
Internal: Insert __typename field selections into query.
Public Class Methods
insert_typename_fields(document, types: {})
click to toggle source
# File lib/graphql/client/query_typename.rb, line 60 def self.insert_typename_fields(document, types: {}) visitor = InsertTypenameVisitor.new(document, types: types) visitor.visit visitor.result end
node_flatten_selections(selections)
click to toggle source
# File lib/graphql/client/query_typename.rb, line 96 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