Class: GraphQLSchema::Type
- Inherits:
-
Object
- Object
- GraphQLSchema::Type
show all
- Includes:
- NamedHash
- Defined in:
- lib/graphql_schema.rb
Constant Summary
collapse
- BUILTIN =
%w(Int Float String Boolean ID).to_set
Instance Method Summary
collapse
Methods included from NamedHash
#camelize_name, #classify_name, #description, #name, #to_h, #upcase_name
Constructor Details
#initialize(type_hash) ⇒ Type
Returns a new instance of Type.
145
146
147
|
# File 'lib/graphql_schema.rb', line 145
def initialize(type_hash)
@hash = type_hash
end
|
Instance Method Details
#builtin? ⇒ Boolean
181
182
183
|
# File 'lib/graphql_schema.rb', line 181
def builtin?
name.start_with?("__") || BUILTIN.include?(name)
end
|
#enum? ⇒ Boolean
169
170
171
|
# File 'lib/graphql_schema.rb', line 169
def enum?
kind == 'ENUM'
end
|
161
162
163
|
# File 'lib/graphql_schema.rb', line 161
def input_object?
kind == 'INPUT_OBJECT'
end
|
#interface? ⇒ Boolean
165
166
167
|
# File 'lib/graphql_schema.rb', line 165
def interface?
kind == 'INTERFACE'
end
|
#kind ⇒ Object
149
150
151
|
# File 'lib/graphql_schema.rb', line 149
def kind
@hash.fetch('kind')
end
|
#list? ⇒ Boolean
177
178
179
|
# File 'lib/graphql_schema.rb', line 177
def list?
kind == 'LIST'
end
|
#object? ⇒ Boolean
157
158
159
|
# File 'lib/graphql_schema.rb', line 157
def object?
kind == 'OBJECT'
end
|
#scalar? ⇒ Boolean
153
154
155
|
# File 'lib/graphql_schema.rb', line 153
def scalar?
kind == 'SCALAR'
end
|
#union? ⇒ Boolean
173
174
175
|
# File 'lib/graphql_schema.rb', line 173
def union?
kind == 'UNION'
end
|