Class: GraphQL::TypeKinds::TypeKind

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

Overview

These objects are singletons, eg GraphQL::TypeKinds::UNION, GraphQL::TypeKinds::SCALAR.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, resolves: false, fields: false, wraps: false, input: false, description: nil) ⇒ TypeKind

Returns a new instance of TypeKind


8
9
10
11
12
13
14
15
16
# File 'lib/graphql/type_kinds.rb', line 8

def initialize(name, resolves: false, fields: false, wraps: false, input: false, description: nil)
  @name = name
  @resolves = resolves
  @fields = fields
  @wraps = wraps
  @input = input
  @composite = fields? || resolves?
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description


7
8
9
# File 'lib/graphql/type_kinds.rb', line 7

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name


7
8
9
# File 'lib/graphql/type_kinds.rb', line 7

def name
  @name
end

Instance Method Details

#composite?Boolean

Is this TypeKind composed of many values?

Returns:

  • (Boolean)

28
# File 'lib/graphql/type_kinds.rb', line 28

def composite?; @composite; end

#fields?Boolean

Does this TypeKind have queryable fields?

Returns:

  • (Boolean)

21
# File 'lib/graphql/type_kinds.rb', line 21

def fields?;    @fields;    end

#input?Boolean

Is this TypeKind a valid query input?

Returns:

  • (Boolean)

25
# File 'lib/graphql/type_kinds.rb', line 25

def input?;     @input;     end

#resolves?Boolean

Does this TypeKind have multiple possible implementors?

Returns:

  • (Boolean)

19
# File 'lib/graphql/type_kinds.rb', line 19

def resolves?;  @resolves;  end

#to_sObject


26
# File 'lib/graphql/type_kinds.rb', line 26

def to_s;       @name;      end

#wraps?Boolean

Does this TypeKind modify another type?

Returns:

  • (Boolean)

23
# File 'lib/graphql/type_kinds.rb', line 23

def wraps?;     @wraps;     end