Class: Graphlyte::Schema::TypeRef

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

Overview

A type ref names a run-time type See ‘Type` for the full type definition.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

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

Constructor Details

This class inherits a constructor from Graphlyte::Data

Instance Attribute Details

#kindObject

Returns the value of attribute kind.



49
50
51
# File 'lib/graphlyte/schema.rb', line 49

def kind
  @kind
end

#nameObject

Returns the value of attribute name.



49
50
51
# File 'lib/graphlyte/schema.rb', line 49

def name
  @name
end

#of_typeObject

Returns the value of attribute of_type.



49
50
51
# File 'lib/graphlyte/schema.rb', line 49

def of_type
  @of_type
end

Class Method Details

.from_schema_response(data) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/graphlyte/schema.rb', line 51

def self.from_schema_response(data)
  return unless data

  ref = new

  ref.name = data['name']
  ref.kind = data['kind'].to_sym
  ref.of_type = TypeRef.from_schema_response(data['ofType'])

  ref
end

Instance Method Details

#unpackObject



63
64
65
66
67
# File 'lib/graphlyte/schema.rb', line 63

def unpack
  return of_type.unpack if of_type

  name
end