Sha256: bad3836ba9ffce12196a27dcd4a4eff1dd853fa9f50f5fc5d660a286a6683af2

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 Bytes

Contents

module GraphQL
  class Directive
    include GraphQL::Define::InstanceDefinable
    accepts_definitions :locations, :name, :description, :include_proc, argument: GraphQL::Define::AssignArgument

    attr_accessor :locations, :arguments, :name, :description

    LOCATIONS = [
      QUERY =               :QUERY,
      MUTATION =            :MUTATION,
      SUBSCRIPTION =        :SUBSCRIPTION,
      FIELD =               :FIELD,
      FRAGMENT_DEFINITION = :FRAGMENT_DEFINITION,
      FRAGMENT_SPREAD =     :FRAGMENT_SPREAD,
      INLINE_FRAGMENT =     :INLINE_FRAGMENT,
    ]

    def initialize
      @arguments = {}
    end

    def include?(arguments)
      @include_proc.call(arguments)
    end

    def include_proc=(include_proc)
      @include_proc = include_proc
    end

    def to_s
      "<GraphQL::Directive #{name}>"
    end
  end
end

require "graphql/directive/include_directive"
require "graphql/directive/skip_directive"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-0.14.0 lib/graphql/directive.rb
graphql-0.13.0 lib/graphql/directive.rb