Class: TRuby::IR::IntersectionType
- Defined in:
- lib/t_ruby/ir.rb
Overview
Intersection type (Readable & Writable)
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) ⇒ IntersectionType
constructor
A new instance of IntersectionType.
- #to_rbs ⇒ Object
- #to_trb ⇒ Object
Methods inherited from Node
#accept, #children, #transform
Constructor Details
#initialize(types: [], **opts) ⇒ IntersectionType
Returns a new instance of IntersectionType.
556 557 558 559 |
# File 'lib/t_ruby/ir.rb', line 556 def initialize(types: [], **opts) super(**opts) @types = types end |
Instance Attribute Details
#types ⇒ Object
Returns the value of attribute types.
554 555 556 |
# File 'lib/t_ruby/ir.rb', line 554 def types @types end |
Instance Method Details
#to_rbs ⇒ Object
561 562 563 |
# File 'lib/t_ruby/ir.rb', line 561 def to_rbs @types.map(&:to_rbs).join(" & ") end |
#to_trb ⇒ Object
565 566 567 |
# File 'lib/t_ruby/ir.rb', line 565 def to_trb @types.map(&:to_trb).join(" & ") end |