Class: Graphlyte::Schema::Directive

Inherits:
Data
  • Object
show all
Defined in:
lib/graphlyte/schema.rb

Overview

A directive adds metadata to a defintion. See: spec.graphql.org/October2021/#sec-Language.Directives

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#==, attr_accessor, attr_reader, attributes, #dup, #eql?, #hash, #inspect

Constructor Details

#initializeDirective

Returns a new instance of Directive.



15
16
17
18
19
# File 'lib/graphlyte/schema.rb', line 15

def initialize(**)
  super

  @arguments ||= {}
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



13
14
15
# File 'lib/graphlyte/schema.rb', line 13

def arguments
  @arguments
end

#descriptionObject

Returns the value of attribute description.



12
13
14
# File 'lib/graphlyte/schema.rb', line 12

def description
  @description
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/graphlyte/schema.rb', line 12

def name
  @name
end

Class Method Details

.from_schema_response(data) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/graphlyte/schema.rb', line 21

def self.from_schema_response(data)
  new(
    name: data['name'],
    description: data['description'],
    arguments: Schema.entity_map(InputValue, data['arguments'])
  )
end