Module: GraphQL::Client::QueryTypename
- Defined in:
- lib/graphql/client/query_typename.rb
Overview
Internal: Insert __typename field selections into query.
Defined Under Namespace
Classes: InsertTypenameVisitor
Class Method Summary collapse
Class Method Details
.insert_typename_fields(document, types: {}) ⇒ Object
60 61 62 63 64 |
# 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) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# 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 |