Class: GraphQL::TypeKinds::TypeKind
- Inherits:
-
Object
- Object
- GraphQL::TypeKinds::TypeKind
- Defined in:
- lib/graphql/type_kinds.rb
Overview
These objects are singletons, eg GraphQL::TypeKinds::UNION
, GraphQL::TypeKinds::SCALAR
.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#abstract? ⇒ Boolean
Is this TypeKind abstract?.
-
#composite? ⇒ Boolean
Is this TypeKind composed of many values?.
-
#enum? ⇒ Boolean
-
#fields? ⇒ Boolean
Does this TypeKind have queryable fields?.
-
#initialize(name, abstract: false, fields: false, wraps: false, input: false, description: nil) ⇒ TypeKind
constructor
A new instance of TypeKind.
-
#input? ⇒ Boolean
Is this TypeKind a valid query input?.
-
#input_object? ⇒ Boolean
-
#interface? ⇒ Boolean
-
#list? ⇒ Boolean
-
#non_null? ⇒ Boolean
-
#object? ⇒ Boolean
-
#resolves? ⇒ Boolean
deprecated
Deprecated.
Use
abstract?
instead ofresolves?
. -
#scalar? ⇒ Boolean
-
#to_s ⇒ Object
-
#union? ⇒ Boolean
-
#wraps? ⇒ Boolean
Does this TypeKind modify another type?.
Constructor Details
#initialize(name, abstract: 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, abstract: false, fields: false, wraps: false, input: false, description: nil) @name = name @abstract = abstract @fields = fields @wraps = wraps @input = input @composite = fields? || abstract? @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description
7 8 9 |
# File 'lib/graphql/type_kinds.rb', line 7 def description @description end |
#name ⇒ Object (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
#abstract? ⇒ Boolean
Is this TypeKind abstract?
22 |
# File 'lib/graphql/type_kinds.rb', line 22 def abstract?; @abstract; end |
#composite? ⇒ Boolean
Is this TypeKind composed of many values?
31 |
# File 'lib/graphql/type_kinds.rb', line 31 def composite?; @composite; end |
#enum? ⇒ Boolean
49 50 51 |
# File 'lib/graphql/type_kinds.rb', line 49 def enum? self == TypeKinds::ENUM end |
#fields? ⇒ Boolean
Does this TypeKind have queryable fields?
24 |
# File 'lib/graphql/type_kinds.rb', line 24 def fields?; @fields; end |
#input? ⇒ Boolean
Is this TypeKind a valid query input?
28 |
# File 'lib/graphql/type_kinds.rb', line 28 def input?; @input; end |
#input_object? ⇒ Boolean
53 54 55 |
# File 'lib/graphql/type_kinds.rb', line 53 def input_object? self == TypeKinds::INPUT_OBJECT end |
#interface? ⇒ Boolean
41 42 43 |
# File 'lib/graphql/type_kinds.rb', line 41 def interface? self == TypeKinds::INTERFACE end |
#list? ⇒ Boolean
57 58 59 |
# File 'lib/graphql/type_kinds.rb', line 57 def list? self == TypeKinds::LIST end |
#non_null? ⇒ Boolean
61 62 63 |
# File 'lib/graphql/type_kinds.rb', line 61 def non_null? self == TypeKinds::NON_NULL end |
#object? ⇒ Boolean
37 38 39 |
# File 'lib/graphql/type_kinds.rb', line 37 def object? self == TypeKinds::OBJECT end |
#resolves? ⇒ Boolean
Use abstract?
instead of resolves?
.
Does this TypeKind have multiple possible implementors?
20 |
# File 'lib/graphql/type_kinds.rb', line 20 def resolves?; @abstract; end |
#scalar? ⇒ Boolean
33 34 35 |
# File 'lib/graphql/type_kinds.rb', line 33 def scalar? self == TypeKinds::SCALAR end |
#to_s ⇒ Object
29 |
# File 'lib/graphql/type_kinds.rb', line 29 def to_s; @name; end |
#union? ⇒ Boolean
45 46 47 |
# File 'lib/graphql/type_kinds.rb', line 45 def union? self == TypeKinds::UNION end |
#wraps? ⇒ Boolean
Does this TypeKind modify another type?
26 |
# File 'lib/graphql/type_kinds.rb', line 26 def wraps?; @wraps; end |