Class: GraphQL::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/field.rb

Overview

Each Node has Fields that are used to look up connected nodes at query-time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:) ⇒ Field

Returns a new instance of Field.



4
5
6
7
# File 'lib/graphql/field.rb', line 4

def initialize(name:, type:)
  @name = name
  @type = type.to_s
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/graphql/field.rb', line 3

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/graphql/field.rb', line 3

def type
  @type
end

Instance Method Details

#type_classObject



9
10
11
# File 'lib/graphql/field.rb', line 9

def type_class
  GraphQL::SCHEMA.get_type(type)
end