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
Does this TypeKind have multiple possible implementers? 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.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/graphql/type_kinds.rb', line 10 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 freeze end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/graphql/type_kinds.rb', line 9 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/graphql/type_kinds.rb', line 9 def name @name end |
Instance Method Details
#abstract? ⇒ Boolean
Is this TypeKind abstract?
26 |
# File 'lib/graphql/type_kinds.rb', line 26 def abstract?; @abstract; end |
#composite? ⇒ Boolean
Is this TypeKind composed of many values?
37 |
# File 'lib/graphql/type_kinds.rb', line 37 def composite?; @composite; end |
#enum? ⇒ Boolean
55 56 57 |
# File 'lib/graphql/type_kinds.rb', line 55 def enum? self == TypeKinds::ENUM end |
#fields? ⇒ Boolean
Does this TypeKind have queryable fields?
28 |
# File 'lib/graphql/type_kinds.rb', line 28 def fields?; @fields; end |
#input? ⇒ Boolean
Is this TypeKind a valid query input?
32 |
# File 'lib/graphql/type_kinds.rb', line 32 def input?; @input; end |
#input_object? ⇒ Boolean
59 60 61 |
# File 'lib/graphql/type_kinds.rb', line 59 def input_object? self == TypeKinds::INPUT_OBJECT end |
#interface? ⇒ Boolean
47 48 49 |
# File 'lib/graphql/type_kinds.rb', line 47 def interface? self == TypeKinds::INTERFACE end |
#leaf? ⇒ Boolean
Is this TypeKind a primitive value?
35 |
# File 'lib/graphql/type_kinds.rb', line 35 def leaf?; @leaf; end |
#list? ⇒ Boolean
63 64 65 |
# File 'lib/graphql/type_kinds.rb', line 63 def list? self == TypeKinds::LIST end |
#non_null? ⇒ Boolean
67 68 69 |
# File 'lib/graphql/type_kinds.rb', line 67 def non_null? self == TypeKinds::NON_NULL end |
#object? ⇒ Boolean
43 44 45 |
# File 'lib/graphql/type_kinds.rb', line 43 def object? self == TypeKinds::OBJECT end |
#resolves? ⇒ Boolean
Does this TypeKind have multiple possible implementers?
Deprecated: Use abstract? instead of resolves?.
24 |
# File 'lib/graphql/type_kinds.rb', line 24 def resolves?; @abstract; end |
#scalar? ⇒ Boolean
39 40 41 |
# File 'lib/graphql/type_kinds.rb', line 39 def scalar? self == TypeKinds::SCALAR end |
#to_s ⇒ Object
33 |
# File 'lib/graphql/type_kinds.rb', line 33 def to_s; @name; end |
#union? ⇒ Boolean
51 52 53 |
# File 'lib/graphql/type_kinds.rb', line 51 def union? self == TypeKinds::UNION end |
#wraps? ⇒ Boolean
Does this TypeKind modify another type?
30 |
# File 'lib/graphql/type_kinds.rb', line 30 def wraps?; @wraps; end |