Class: GraphWeaver::Codegen::EnumNode
- Inherits:
-
Object
- Object
- GraphWeaver::Codegen::EnumNode
- Defined in:
- lib/graph_weaver/codegen.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #bare_type ⇒ Object
- #cast(expr, _depth) ⇒ Object
- #identity? ⇒ Boolean
-
#initialize(class_name, values) ⇒ EnumNode
constructor
A new instance of EnumNode.
- #nested ⇒ Object
- #non_null? ⇒ Boolean
- #prop_type ⇒ Object
- #serialize(expr, _depth) ⇒ Object
- #serialize_identity? ⇒ Boolean
Constructor Details
#initialize(class_name, values) ⇒ EnumNode
Returns a new instance of EnumNode.
158 159 160 161 |
# File 'lib/graph_weaver/codegen.rb', line 158 def initialize(class_name, values) @class_name = class_name @values = values end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
156 157 158 |
# File 'lib/graph_weaver/codegen.rb', line 156 def class_name @class_name end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
156 157 158 |
# File 'lib/graph_weaver/codegen.rb', line 156 def values @values end |
Instance Method Details
#bare_type ⇒ Object
163 |
# File 'lib/graph_weaver/codegen.rb', line 163 def = class_name |
#cast(expr, _depth) ⇒ Object
169 170 171 |
# File 'lib/graph_weaver/codegen.rb', line 169 def cast(expr, _depth) "#{class_name}.deserialize(#{expr})" end |
#identity? ⇒ Boolean
173 |
# File 'lib/graph_weaver/codegen.rb', line 173 def identity? = false |
#nested ⇒ Object
181 |
# File 'lib/graph_weaver/codegen.rb', line 181 def nested = self |
#non_null? ⇒ Boolean
180 |
# File 'lib/graph_weaver/codegen.rb', line 180 def non_null? = false |
#prop_type ⇒ Object
165 166 167 |
# File 'lib/graph_weaver/codegen.rb', line 165 def prop_type "T.nilable(#{})" end |
#serialize(expr, _depth) ⇒ Object
175 176 177 |
# File 'lib/graph_weaver/codegen.rb', line 175 def serialize(expr, _depth) "#{expr}.serialize" end |
#serialize_identity? ⇒ Boolean
179 |
# File 'lib/graph_weaver/codegen.rb', line 179 def serialize_identity? = false |