Sha256: 2395acac4df9df0d851aa8522de06bb10696e693155c8dee353522c0c191c498

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

GraphQL::IncludeDirective = GraphQL::Directive.new do |d|
  d.name "include"
  d.description "Include this part of the query if `if` is true"
  d.on([GraphQL::Directive::ON_FIELD, GraphQL::Directive::ON_FRAGMENT])
  d.arguments({
    if: d.arg({type: !GraphQL::BOOLEAN_TYPE})
  })
  d.resolve -> (arguments, proc) {
    if arguments["if"]
      proc.call
    else
      nil
    end
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.1.0 lib/graph_ql/directives/include_directive.rb