Class: GraphWeaver::Codegen::ObjectNode
- Inherits:
-
Object
- Object
- GraphWeaver::Codegen::ObjectNode
- Defined in:
- lib/graph_weaver/codegen/nodes.rb
Defined Under Namespace
Classes: Field
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#graphql_type ⇒ Object
the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type).
-
#mixins ⇒ Object
the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type).
Instance Method Summary collapse
- #bare_type ⇒ Object
- #cast(expr, _depth) ⇒ Object
- #identity? ⇒ Boolean
-
#initialize(class_name) ⇒ ObjectNode
constructor
A new instance of ObjectNode.
- #nested ⇒ Object
- #non_null? ⇒ Boolean
- #prop_type ⇒ Object
Constructor Details
#initialize(class_name) ⇒ ObjectNode
Returns a new instance of ObjectNode.
148 149 150 151 152 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 148 def initialize(class_name) @class_name = class_name @fields = [] @mixins = [] end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
143 144 145 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 143 def class_name @class_name end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
143 144 145 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 143 def fields @fields end |
#graphql_type ⇒ Object
the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type)
146 147 148 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 146 def graphql_type @graphql_type end |
#mixins ⇒ Object
the GraphQL type this struct was generated from, and any registered helper modules to include (see Codegen.register_type)
146 147 148 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 146 def mixins @mixins end |
Instance Method Details
#bare_type ⇒ Object
154 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 154 def = class_name |
#cast(expr, _depth) ⇒ Object
160 161 162 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 160 def cast(expr, _depth) "#{class_name}.from_h(#{expr})" end |
#identity? ⇒ Boolean
164 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 164 def identity? = false |
#nested ⇒ Object
166 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 166 def nested = self |
#non_null? ⇒ Boolean
165 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 165 def non_null? = false |
#prop_type ⇒ Object
156 157 158 |
# File 'lib/graph_weaver/codegen/nodes.rb', line 156 def prop_type "T.nilable(#{})" end |