Class: TRuby::IR::UnionType
Overview
Union type (String | Integer | nil)
Instance Attribute Summary collapse
-
#types ⇒ Object
Returns the value of attribute types.
Attributes inherited from Node
#location, #metadata, #type_info
Instance Method Summary collapse
-
#initialize(types: [], **opts) ⇒ UnionType
constructor
A new instance of UnionType.
- #to_rbs ⇒ Object
- #to_trb ⇒ Object
Methods inherited from Node
#accept, #children, #transform
Constructor Details
#initialize(types: [], **opts) ⇒ UnionType
Returns a new instance of UnionType.
538 539 540 541 |
# File 'lib/t_ruby/ir.rb', line 538 def initialize(types: [], **opts) super(**opts) @types = types end |
Instance Attribute Details
#types ⇒ Object
Returns the value of attribute types.
536 537 538 |
# File 'lib/t_ruby/ir.rb', line 536 def types @types end |
Instance Method Details
#to_rbs ⇒ Object
543 544 545 |
# File 'lib/t_ruby/ir.rb', line 543 def to_rbs @types.map(&:to_rbs).join(" | ") end |
#to_trb ⇒ Object
547 548 549 |
# File 'lib/t_ruby/ir.rb', line 547 def to_trb @types.map(&:to_trb).join(" | ") end |