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