class GraphQL::Directive
- ‘@include(if: …)` Includes the tagged field only if `if` is true
- `@skip(if: …)` Skips the tagged field if the value of `if` is true
Two directives are included out-of-the-box:
Directives are server-defined hooks for modifying execution.
def include?(arguments)
def include?(arguments) include_proc.call(arguments) end
def initialize
def initialize @arguments = {} end
def on_field?
def on_field? locations.include?(FIELD) end
def on_fragment?
def on_fragment? locations.include?(FRAGMENT_SPREAD) && locations.include?(INLINE_FRAGMENT) end
def on_operation?
def on_operation? locations.include?(QUERY) && locations.include?(MUTATION) && locations.include?(SUBSCRIPTION) end
def to_s
def to_s "<GraphQL::Directive #{name}>" end