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.



625
626
627
628
# File 'lib/t_ruby/ir.rb', line 625

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

Instance Attribute Details

#element_typesObject

Returns the value of attribute element_types.



623
624
625
# File 'lib/t_ruby/ir.rb', line 623

def element_types
  @element_types
end

Instance Method Details

#to_rbsObject



630
631
632
# File 'lib/t_ruby/ir.rb', line 630

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

#to_trbObject



634
635
636
# File 'lib/t_ruby/ir.rb', line 634

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