Class: ElasticGraph::SchemaDefinition::SchemaElements::Directive
- Inherits:
-
Data
- Object
- Data
- ElasticGraph::SchemaDefinition::SchemaElements::Directive
- Includes:
- Mixins::VerifiesGraphQLName
- Defined in:
- elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb,
elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb
Overview
Represents a GraphQL directive.
Instance Attribute Summary collapse
-
#arguments ⇒ Hash<Symbol, Object>
readonly
Directive arguments.
-
#name ⇒ String
readonly
Name of the directive.
Instance Method Summary collapse
-
#duplicate_on(element) ⇒ void
Duplicates this directive on another GraphQL schema element.
-
#to_sdl ⇒ String
GraphQL SDL form of the directive.
Methods included from Mixins::VerifiesGraphQLName
Instance Attribute Details
#arguments ⇒ Hash<Symbol, Object> (readonly)
Returns directive arguments.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb', line 22 class Directive < ::Data.define(:name, :arguments) prepend Mixins::VerifiesGraphQLName # @return [String] GraphQL SDL form of the directive def to_sdl %(@#{name}#{Support::GraphQLFormatter.format_args(**arguments)}) end # Duplicates this directive on another GraphQL schema element. # # @param element [Argument, EnumType, EnumValue, Field, ScalarType, TypeWithSubfields, UnionType] schema element # @return [void] def duplicate_on(element) element.directive name, arguments end end |
#name ⇒ String (readonly)
Returns name of the directive.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb', line 22 class Directive < ::Data.define(:name, :arguments) prepend Mixins::VerifiesGraphQLName # @return [String] GraphQL SDL form of the directive def to_sdl %(@#{name}#{Support::GraphQLFormatter.format_args(**arguments)}) end # Duplicates this directive on another GraphQL schema element. # # @param element [Argument, EnumType, EnumValue, Field, ScalarType, TypeWithSubfields, UnionType] schema element # @return [void] def duplicate_on(element) element.directive name, arguments end end |
Instance Method Details
#duplicate_on(element) ⇒ void
This method returns an undefined value.
Duplicates this directive on another GraphQL schema element.
34 35 36 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb', line 34 def duplicate_on(element) element.directive name, arguments end |
#to_sdl ⇒ String
Returns GraphQL SDL form of the directive.
26 27 28 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/directive.rb', line 26 def to_sdl %(@#{name}#{Support::GraphQLFormatter.format_args(**arguments)}) end |