Class: TRuby::IR::TupleType

Inherits:
TypeNode show all
Defined in:
lib/t_ruby/ir.rb

Overview

Tuple type ([String, Integer, Boolean])

Instance Attribute Summary collapse

Attributes inherited from Node

#location, #metadata, #type_info

Instance Method Summary collapse

Methods inherited from Node

#accept, #children, #transform

Constructor Details

#initialize(element_types: [], **opts) ⇒ TupleType

Returns a new instance of TupleType.



595
596
597
598
# File 'lib/t_ruby/ir.rb', line 595

def initialize(element_types: [], **opts)
  super(**opts)
  @element_types = element_types
end

Instance Attribute Details

#element_typesObject

Returns the value of attribute element_types.



593
594
595
# File 'lib/t_ruby/ir.rb', line 593

def element_types
  @element_types
end

Instance Method Details

#to_rbsObject



600
601
602
# File 'lib/t_ruby/ir.rb', line 600

def to_rbs
  "[#{@element_types.map(&:to_rbs).join(', ')}]"
end

#to_trbObject



604
605
606
# File 'lib/t_ruby/ir.rb', line 604

def to_trb
  "[#{@element_types.map(&:to_trb).join(', ')}]"
end