Class: GraphQL::DSL::Directive
- Inherits:
-
Object
- Object
- GraphQL::DSL::Directive
- Defined in:
- lib/graphql/dsl/nodes/containers/directive.rb
Overview
Container for directive
Instance Attribute Summary collapse
-
#arguments ⇒ Hash
readonly
Arguments.
-
#name ⇒ String, ...
readonly
Directive name.
Class Method Summary collapse
-
.from(value) ⇒ Directive
Create directive container from argument value.
Instance Method Summary collapse
-
#initialize(name, arguments = {}) ⇒ Directive
constructor
Create directive container.
Constructor Details
#initialize(name, arguments = {}) ⇒ Directive
Create directive container
21 22 23 24 25 26 |
# File 'lib/graphql/dsl/nodes/containers/directive.rb', line 21 def initialize(name, arguments = {}) raise Error, 'Variable name must be specified' if name.nil? || name.empty? @name = name @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Hash (readonly)
Returns arguments.
14 15 16 |
# File 'lib/graphql/dsl/nodes/containers/directive.rb', line 14 def arguments @arguments end |
#name ⇒ String, ... (readonly)
Returns directive name.
10 11 12 |
# File 'lib/graphql/dsl/nodes/containers/directive.rb', line 10 def name @name end |
Class Method Details
.from(value) ⇒ Directive
Create directive container from argument value
35 36 37 38 39 40 41 42 |
# File 'lib/graphql/dsl/nodes/containers/directive.rb', line 35 def from(value) case value when Directive then value when Symbol, String then new(value) else raise Error.new('Unsupported format of directive', class: value.class.name, value: value) end end |