Class: GraphWeaver::Codegen::ObjectNode

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

Defined Under Namespace

Classes: Alias, 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.



156
157
158
159
160
161
# File 'lib/graph_weaver/codegen/nodes.rb', line 156

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

Instance Attribute Details

#aliasesObject

the GraphQL type this struct was generated from, any registered helper modules to include, and any resolved alias delegators (see extend_type)



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

def aliases
  @aliases
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



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

def class_name
  @class_name
end

#fieldsObject (readonly)

Returns the value of attribute fields.



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

def fields
  @fields
end

#graphql_typeObject

the GraphQL type this struct was generated from, any registered helper modules to include, and any resolved alias delegators (see extend_type)



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

def graphql_type
  @graphql_type
end

#mixinsObject

the GraphQL type this struct was generated from, any registered helper modules to include, and any resolved alias delegators (see extend_type)



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

def mixins
  @mixins
end

Instance Method Details

#bare_typeObject



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

def bare_type = class_name

#cast(expr, _depth) ⇒ Object



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

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

#nestedObject



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

def nested = self