Class: GraphQLSchema::TypeDeclaration
- Inherits:
-
Type
- Object
- Type
- GraphQLSchema::TypeDeclaration
show all
- Defined in:
- lib/graphql_schema.rb
Constant Summary
Constants inherited
from Type
GraphQLSchema::Type::BUILTIN
Instance Method Summary
collapse
Methods inherited from Type
#builtin?, #enum?, #initialize, #input_object?, #interface?, #kind, #list?, #object?, #scalar?, #union?
Methods included from NamedHash
#camelize_name, #classify_name, #name, #upcase_name
Instance Method Details
#non_null? ⇒ Boolean
170
171
172
|
# File 'lib/graphql_schema.rb', line 170
def non_null?
kind == 'NON_NULL'
end
|
#of_type ⇒ Object
166
167
168
|
# File 'lib/graphql_schema.rb', line 166
def of_type
@of_type ||= TypeDeclaration.new(@hash.fetch('ofType'))
end
|
#subfields? ⇒ Boolean
187
188
189
190
191
192
193
194
|
# File 'lib/graphql_schema.rb', line 187
def subfields?
case unwrap.kind
when 'OBJECT', 'INTERFACE', 'UNION'
true
else
false
end
end
|
#unwrap ⇒ Object
174
175
176
177
178
179
180
181
|
# File 'lib/graphql_schema.rb', line 174
def unwrap
case kind
when 'NON_NULL', 'LIST'
of_type.unwrap
else
self
end
end
|
#unwrap_non_null ⇒ Object
183
184
185
|
# File 'lib/graphql_schema.rb', line 183
def unwrap_non_null
non_null? ? of_type.unwrap_non_null : self
end
|