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.
132
133
134
|
# File 'lib/graphql_schema.rb', line 132
def initialize(type_hash)
@hash = type_hash
end
|
Instance Method Details
#builtin? ⇒ Boolean
168
169
170
|
# File 'lib/graphql_schema.rb', line 168
def builtin?
name.start_with?("__") || BUILTIN.include?(name)
end
|
#enum? ⇒ Boolean
156
157
158
|
# File 'lib/graphql_schema.rb', line 156
def enum?
kind == 'ENUM'
end
|
148
149
150
|
# File 'lib/graphql_schema.rb', line 148
def input_object?
kind == 'INPUT_OBJECT'
end
|
#interface? ⇒ Boolean
152
153
154
|
# File 'lib/graphql_schema.rb', line 152
def interface?
kind == 'INTERFACE'
end
|
#kind ⇒ Object
136
137
138
|
# File 'lib/graphql_schema.rb', line 136
def kind
@hash.fetch('kind')
end
|
#list? ⇒ Boolean
164
165
166
|
# File 'lib/graphql_schema.rb', line 164
def list?
kind == 'LIST'
end
|
#object? ⇒ Boolean
144
145
146
|
# File 'lib/graphql_schema.rb', line 144
def object?
kind == 'OBJECT'
end
|
#scalar? ⇒ Boolean
140
141
142
|
# File 'lib/graphql_schema.rb', line 140
def scalar?
kind == 'SCALAR'
end
|
#union? ⇒ Boolean
160
161
162
|
# File 'lib/graphql_schema.rb', line 160
def union?
kind == 'UNION'
end
|