Class: GraphWeaver::Codegen::ObjectNode
- Inherits:
-
Object
- Object
- GraphWeaver::Codegen::ObjectNode
- Defined in:
- lib/graph_weaver/codegen.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.
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.
135 136 137 138 |
# File 'lib/graph_weaver/codegen.rb', line 135 def initialize(class_name) @class_name = class_name @fields = [] end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
133 134 135 |
# File 'lib/graph_weaver/codegen.rb', line 133 def class_name @class_name end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
133 134 135 |
# File 'lib/graph_weaver/codegen.rb', line 133 def fields @fields end |
Instance Method Details
#bare_type ⇒ Object
140 |
# File 'lib/graph_weaver/codegen.rb', line 140 def = class_name |
#cast(expr, _depth) ⇒ Object
146 147 148 |
# File 'lib/graph_weaver/codegen.rb', line 146 def cast(expr, _depth) "#{class_name}.from_h(#{expr})" end |
#identity? ⇒ Boolean
150 |
# File 'lib/graph_weaver/codegen.rb', line 150 def identity? = false |
#nested ⇒ Object
152 |
# File 'lib/graph_weaver/codegen.rb', line 152 def nested = self |
#non_null? ⇒ Boolean
151 |
# File 'lib/graph_weaver/codegen.rb', line 151 def non_null? = false |
#prop_type ⇒ Object
142 143 144 |
# File 'lib/graph_weaver/codegen.rb', line 142 def prop_type "T.nilable(#{})" end |