Method: GraphQL::Execution::DirectiveChecks.include?
- Defined in:
- lib/graphql/execution/directive_checks.rb
.include?(directive_ast_nodes, query) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Should this node be included in the query?.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/graphql/execution/directive_checks.rb', line 14 def include?(directive_ast_nodes, query) directive_ast_nodes.each do |directive_ast_node| name = directive_ast_node.name directive_defn = query.schema.directives[name] case name when SKIP args = query.arguments_for(directive_ast_node, directive_defn) if args[:if] == true return false end when INCLUDE args = query.arguments_for(directive_ast_node, directive_defn) if args[:if] == false return false end else # Undefined directive, or one we don't care about end end true end |