Class: GraphWeaver::Codegen::ObjectNode

Inherits:
Node
  • Object
show all
Defined in:
lib/graph_weaver/codegen/nodes.rb

Defined Under Namespace

Classes: Field

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#coerce?, #hash_coerce_identity?, #identity?, #non_null?, #prop_type, #serialize_identity?

Constructor Details

#initialize(class_name) ⇒ ObjectNode

Returns a new instance of ObjectNode.



153
154
155
156
157
# File 'lib/graph_weaver/codegen/nodes.rb', line 153

def initialize(class_name)
  @class_name = class_name
  @fields = []
  @mixins = []
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



148
149
150
# File 'lib/graph_weaver/codegen/nodes.rb', line 148

def class_name
  @class_name
end

#fieldsObject (readonly)

Returns the value of attribute fields.



148
149
150
# File 'lib/graph_weaver/codegen/nodes.rb', line 148

def fields
  @fields
end

#graphql_typeObject

the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type)



151
152
153
# File 'lib/graph_weaver/codegen/nodes.rb', line 151

def graphql_type
  @graphql_type
end

#mixinsObject

the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type)



151
152
153
# File 'lib/graph_weaver/codegen/nodes.rb', line 151

def mixins
  @mixins
end

Instance Method Details

#bare_typeObject



159
# File 'lib/graph_weaver/codegen/nodes.rb', line 159

def bare_type = class_name

#cast(expr, _depth) ⇒ Object



161
162
163
# File 'lib/graph_weaver/codegen/nodes.rb', line 161

def cast(expr, _depth)
  "#{class_name}.from_h(#{expr})"
end

#nestedObject



165
# File 'lib/graph_weaver/codegen/nodes.rb', line 165

def nested = self