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, leaf: 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
-
#leaf? ⇒ Boolean
Is this TypeKind a primitive value?.
-
#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, leaf: 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 17 |
# File 'lib/graphql/type_kinds.rb', line 8 def initialize(name, abstract: false, leaf: false, fields: false, wraps: false, input: false, description: nil) @name = name @abstract = abstract @fields = fields @wraps = wraps @input = input @leaf = leaf @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?
23 |
# File 'lib/graphql/type_kinds.rb', line 23 def abstract?; @abstract; end |
#composite? ⇒ Boolean
Is this TypeKind composed of many values?
34 |
# File 'lib/graphql/type_kinds.rb', line 34 def composite?; @composite; end |
#enum? ⇒ Boolean
52 53 54 |
# File 'lib/graphql/type_kinds.rb', line 52 def enum? self == TypeKinds::ENUM end |
#fields? ⇒ Boolean
Does this TypeKind have queryable fields?
25 |
# File 'lib/graphql/type_kinds.rb', line 25 def fields?; @fields; end |
#input? ⇒ Boolean
Is this TypeKind a valid query input?
29 |
# File 'lib/graphql/type_kinds.rb', line 29 def input?; @input; end |
#input_object? ⇒ Boolean
56 57 58 |
# File 'lib/graphql/type_kinds.rb', line 56 def input_object? self == TypeKinds::INPUT_OBJECT end |
#interface? ⇒ Boolean
44 45 46 |
# File 'lib/graphql/type_kinds.rb', line 44 def interface? self == TypeKinds::INTERFACE end |
#leaf? ⇒ Boolean
Is this TypeKind a primitive value?
32 |
# File 'lib/graphql/type_kinds.rb', line 32 def leaf?; @leaf; end |
#list? ⇒ Boolean
60 61 62 |
# File 'lib/graphql/type_kinds.rb', line 60 def list? self == TypeKinds::LIST end |
#non_null? ⇒ Boolean
64 65 66 |
# File 'lib/graphql/type_kinds.rb', line 64 def non_null? self == TypeKinds::NON_NULL end |
#object? ⇒ Boolean
40 41 42 |
# File 'lib/graphql/type_kinds.rb', line 40 def object? self == TypeKinds::OBJECT end |
#resolves? ⇒ Boolean
Use abstract?
instead of resolves?
.
Does this TypeKind have multiple possible implementors?
21 |
# File 'lib/graphql/type_kinds.rb', line 21 def resolves?; @abstract; end |
#scalar? ⇒ Boolean
36 37 38 |
# File 'lib/graphql/type_kinds.rb', line 36 def scalar? self == TypeKinds::SCALAR end |
#to_s ⇒ Object
30 |
# File 'lib/graphql/type_kinds.rb', line 30 def to_s; @name; end |
#union? ⇒ Boolean
48 49 50 |
# File 'lib/graphql/type_kinds.rb', line 48 def union? self == TypeKinds::UNION end |
#wraps? ⇒ Boolean
Does this TypeKind modify another type?
27 |
# File 'lib/graphql/type_kinds.rb', line 27 def wraps?; @wraps; end |