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.



611
612
613
614
# File 'lib/t_ruby/ir.rb', line 611

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

Instance Attribute Details

#element_typesObject

Returns the value of attribute element_types.



609
610
611
# File 'lib/t_ruby/ir.rb', line 609

def element_types
  @element_types
end

Instance Method Details

#to_rbsObject



616
617
618
# File 'lib/t_ruby/ir.rb', line 616

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

#to_trbObject



620
621
622
# File 'lib/t_ruby/ir.rb', line 620

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