Class: GraphQL::ObjectType
Instance Method Summary
collapse
Methods included from Definable
attr_definable
#!
Constructor Details
#initialize {|_self, GraphQL::TypeDefiner.instance, GraphQL::FieldDefiner.instance, GraphQL::ArgumentDefiner.instance| ... } ⇒ ObjectType
Returns a new instance of ObjectType.
Instance Method Details
#fields(new_fields = nil) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/graph_ql/types/object_type.rb', line 12
def fields(new_fields=nil)
if new_fields
self.fields = new_fields
else
@fields
end
end
|
#fields=(new_fields) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/graph_ql/types/object_type.rb', line 20
def fields=(new_fields)
stringified_fields = new_fields
.reduce({}) { |memo, (key, value)| memo[key.to_s] = value; memo }
stringified_fields.each {|k, v| v.respond_to?("name=") && v.name = k }
stringified_fields["__typename"] = GraphQL::Introspection::TypenameField.create(self)
@fields = stringified_fields
end
|
#inspect ⇒ Object
48
49
50
|
# File 'lib/graph_ql/types/object_type.rb', line 48
def inspect
to_s
end
|
#interfaces(new_interfaces = nil) ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/graph_ql/types/object_type.rb', line 29
def interfaces(new_interfaces=nil)
if new_interfaces.nil?
@interfaces
else
@interfaces = new_interfaces
new_interfaces.each {|i| i.possible_types << self }
end
end
|
#kind ⇒ Object
40
41
42
|
# File 'lib/graph_ql/types/object_type.rb', line 40
def kind
GraphQL::TypeKinds::OBJECT
end
|
#to_s ⇒ Object
44
45
46
|
# File 'lib/graph_ql/types/object_type.rb', line 44
def to_s
"<GraphQL::ObjectType #{name}>"
end
|