Class: MilkTea::Types::VariantArmPayload
- Defined in:
- lib/milk_tea/core/types/types.rb
Overview
Synthetic struct-like type used only as the binding type for as name in
variant match arms. Never declared as a named type; lives only in scopes.
Instance Attribute Summary collapse
-
#arm_name ⇒ Object
readonly
Returns the value of attribute arm_name.
-
#variant_type ⇒ Object
readonly
Returns the value of attribute variant_type.
Attributes inherited from Struct
#alignment, #ast_declaration, #external, #lifetime_params, #linkage_name, #module_name, #name, #nested_types, #packed
Instance Method Summary collapse
-
#initialize(variant_type, arm_name, fields) ⇒ VariantArmPayload
constructor
A new instance of VariantArmPayload.
- #to_s ⇒ Object
Methods inherited from Struct
#children, #define_events, #define_fields, #define_nested_types, #eql?, #event, #events, #field, #field_c_name, #fields, #has_events?, #hash, #set_layout
Methods inherited from Base
#accept, #bitwise?, #boolean?, #children, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(variant_type, arm_name, fields) ⇒ VariantArmPayload
Returns a new instance of VariantArmPayload.
1181 1182 1183 1184 1185 1186 |
# File 'lib/milk_tea/core/types/types.rb', line 1181 def initialize(variant_type, arm_name, fields) super("#{variant_type.name}_#{arm_name}", module_name: variant_type.module_name) @variant_type = variant_type @arm_name = arm_name define_fields(fields) end |
Instance Attribute Details
#arm_name ⇒ Object (readonly)
Returns the value of attribute arm_name.
1179 1180 1181 |
# File 'lib/milk_tea/core/types/types.rb', line 1179 def arm_name @arm_name end |
#variant_type ⇒ Object (readonly)
Returns the value of attribute variant_type.
1179 1180 1181 |
# File 'lib/milk_tea/core/types/types.rb', line 1179 def variant_type @variant_type end |
Instance Method Details
#to_s ⇒ Object
1188 1189 1190 |
# File 'lib/milk_tea/core/types/types.rb', line 1188 def to_s "#{variant_type}.#{arm_name} payload" end |