Class: GraphWeaver::Codegen::UnionNode
- Inherits:
-
Object
- Object
- GraphWeaver::Codegen::UnionNode
- Defined in:
- lib/graph_weaver/codegen.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
graphql type name => ObjectNode.
-
#members ⇒ Object
readonly
graphql type name => ObjectNode.
Instance Method Summary collapse
- #bare_type ⇒ Object
- #cast(expr, _depth) ⇒ Object
- #identity? ⇒ Boolean
-
#initialize(class_name, members) ⇒ UnionNode
constructor
A new instance of UnionNode.
- #nested ⇒ Object
- #non_null? ⇒ Boolean
- #prop_type ⇒ Object
Constructor Details
#initialize(class_name, members) ⇒ UnionNode
Returns a new instance of UnionNode.
187 188 189 190 |
# File 'lib/graph_weaver/codegen.rb', line 187 def initialize(class_name, members) @class_name = class_name @members = members end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
graphql type name => ObjectNode
185 186 187 |
# File 'lib/graph_weaver/codegen.rb', line 185 def class_name @class_name end |
#members ⇒ Object (readonly)
graphql type name => ObjectNode
185 186 187 |
# File 'lib/graph_weaver/codegen.rb', line 185 def members @members end |
Instance Method Details
#bare_type ⇒ Object
192 |
# File 'lib/graph_weaver/codegen.rb', line 192 def = "#{class_name}::Type" |
#cast(expr, _depth) ⇒ Object
198 199 200 |
# File 'lib/graph_weaver/codegen.rb', line 198 def cast(expr, _depth) "#{class_name}.from_h(#{expr})" end |
#identity? ⇒ Boolean
202 |
# File 'lib/graph_weaver/codegen.rb', line 202 def identity? = false |
#nested ⇒ Object
204 |
# File 'lib/graph_weaver/codegen.rb', line 204 def nested = self |
#non_null? ⇒ Boolean
203 |
# File 'lib/graph_weaver/codegen.rb', line 203 def non_null? = false |
#prop_type ⇒ Object
194 195 196 |
# File 'lib/graph_weaver/codegen.rb', line 194 def prop_type "T.nilable(#{})" end |