Sha256: 0e55415574c1dcd5cfe47d6a2ca7472514b3b851f9912e51938028c34114af2a

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents

GraphQL::Directive::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.5.0 lib/graph_ql/directive/skip_directive.rb
graphql-0.4.0 lib/graph_ql/directive/skip_directive.rb