Module: GraphQL::Execution::DirectiveChecks
- Defined in:
- lib/graphql/execution/directive_checks.rb
Overview
Boolean checks for how an AST node's directives should influence its execution
Constant Summary collapse
- SKIP =
"skip"- INCLUDE =
"include"
Class Method Summary collapse
-
.include?(directive_irep_nodes, query) ⇒ Boolean
Should this node be included in the query?.
Class Method Details
.include?(directive_irep_nodes, query) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/graphql/execution/directive_checks.rb', line 12 def include?(directive_irep_nodes, query) directive_irep_nodes.each do |directive_irep_node| name = directive_irep_node.name directive_defn = query.schema.directives[name] case name when SKIP args = query.arguments_for(directive_irep_node, directive_defn) if args['if'] == true return false end when INCLUDE args = query.arguments_for(directive_irep_node, directive_defn) if args['if'] == false return false end else # Undefined directive, or one we don't care about end end true end |