Class: GraphQL::Schema::Directive::Flagged
- Inherits:
-
GraphQL::Schema::Directive
- Object
- Member
- GraphQL::Schema::Directive
- GraphQL::Schema::Directive::Flagged
- Defined in:
- lib/graphql/schema/directive/flagged.rb
Overview
This is similar to Directive::Feature, except it's prescribed by the server, not the client.
In this case, the server hides types and fields entirely, unless the current context has certain :flags present.
Defined Under Namespace
Modules: VisibleByFlag
Constant Summary
Constants inherited from GraphQL::Schema::Directive
DEFAULT_DEPRECATION_REASON, LOCATIONS, LOCATION_DESCRIPTIONS
Constants included from Member::HasArguments
Member::HasArguments::NO_ARGUMENTS
Constants included from EmptyObjects
EmptyObjects::EMPTY_ARRAY, EmptyObjects::EMPTY_HASH
Constants included from Member::GraphQLTypeNames
Member::GraphQLTypeNames::Boolean, Member::GraphQLTypeNames::ID, Member::GraphQLTypeNames::Int
Instance Attribute Summary
Attributes inherited from GraphQL::Schema::Directive
Attributes included from Member::BaseDSLMethods
#default_graphql_name, #graphql_name
Attributes included from Member::RelayShortcuts
#connection_type, #connection_type_class, #edge_type, #edge_type_class
Attributes included from Member::HasAstNode
Instance Method Summary collapse
-
#initialize(target, **options) ⇒ Flagged
constructor
: (untyped target, **untyped options) -> void.
Methods inherited from GraphQL::Schema::Directive
default_directive, default_directive?, default_graphql_name, #graphql_name, include?, locations, on_field?, on_fragment?, on_operation?, path, repeatable, repeatable?, resolve, resolve_each, resolve_field, resolve_fragment_spread, resolve_inline_fragment, resolve_operation, runtime?, static_include?, validate!
Methods included from Member::HasArguments
#add_argument, #all_argument_definitions, #any_arguments?, #argument, #argument_class, #arguments, #arguments_statically_coercible?, #coerce_arguments, extended, #get_argument, included, #own_arguments, #remove_argument, #validate_directive_argument
Methods included from Member::HasArguments::HasDirectiveArguments
Methods included from Member::HasValidators
extended, #validates, #validators
Methods inherited from Member
Methods included from Member::BaseDSLMethods
#authorized?, #comment, #default_relay?, #description, #introspection, #introspection?, #mutation, #visible?
Methods included from FindInheritedValue
Methods included from Member::BaseDSLMethods::ConfigurationExtension
Methods included from Member::TypeSystemHelpers
#kind, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature
Methods included from Member::Scoped
#inherited, #reauthorize_scoped_objects, #scope_items
Methods included from Member::HasPath
Methods included from Member::HasAstNode
Methods included from Member::HasDirectives
add_directive, #directive, #directives, extended, get_directives, #inherited, #remove_directive, remove_directive
Constructor Details
#initialize(target, **options) ⇒ Flagged
: (untyped target, **untyped options) -> void
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/graphql/schema/directive/flagged.rb', line 12 def initialize(target, **) if target.is_a?(Module) # This is type class of some kind, `include` will put this module # in between the type class itself and its super class, so `super` will work fine target.include(VisibleByFlag) elsif !target.is_a?(VisibleByFlag) # This is an instance of a base class. `include` won't put this in front of the # base class implementation, so we need to `.prepend`. # `#visible?` could probably be moved to a module and then this could use `include` instead. target.class.prepend(VisibleByFlag) end super end |