Sha256: 661d85241fcab7f1c37ee87385d32ca864296166beb1e6da56b012b61fb309f3

Contents?: true

Size: 406 Bytes

Versions: 2

Compression:

Stored size: 406 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-0.3.0 lib/graph_ql/directives/skip_directive.rb
graphql-0.2.0 lib/graph_ql/directives/skip_directive.rb