Sha256: dcf0821182d5238b000356c9bd596e41241aeee61be4d1ce18e6e39228d28131
Contents?: true
Size: 1.16 KB
Versions: 8
Compression:
Stored size: 1.16 KB
Contents
module GraphQL class Directive include GraphQL::Define::InstanceDefinable accepts_definitions :locations, :name, :description, :include_proc, argument: GraphQL::Define::AssignArgument lazy_defined_attr_accessor :locations, :arguments, :name, :description, :include_proc 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 to_s "<GraphQL::Directive #{name}>" end def on_field? locations.include?(FIELD) end def on_fragment? locations.include?(FRAGMENT_SPREAD) && locations.include?(INLINE_FRAGMENT) end def on_operation? locations.include?(QUERY) && locations.include?(MUTATION) && locations.include?(SUBSCRIPTION) end end end require "graphql/directive/include_directive" require "graphql/directive/skip_directive"
Version data entries
8 entries across 8 versions & 1 rubygems