Class: TRuby::IR::GenericType
- Defined in:
- lib/t_ruby/ir.rb
Overview
Generic type (Array<String>, Map<K, V>)
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#type_args ⇒ Object
Returns the value of attribute type_args.
Attributes inherited from Node
#location, #metadata, #type_info
Instance Method Summary collapse
-
#initialize(base:, type_args: [], **opts) ⇒ GenericType
constructor
A new instance of GenericType.
- #to_rbs ⇒ Object
- #to_trb ⇒ Object
Methods inherited from Node
#accept, #children, #transform
Constructor Details
#initialize(base:, type_args: [], **opts) ⇒ GenericType
Returns a new instance of GenericType.
519 520 521 522 523 |
# File 'lib/t_ruby/ir.rb', line 519 def initialize(base:, type_args: [], **opts) super(**opts) @base = base @type_args = type_args end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
517 518 519 |
# File 'lib/t_ruby/ir.rb', line 517 def base @base end |
#type_args ⇒ Object
Returns the value of attribute type_args.
517 518 519 |
# File 'lib/t_ruby/ir.rb', line 517 def type_args @type_args end |
Instance Method Details
#to_rbs ⇒ Object
525 526 527 |
# File 'lib/t_ruby/ir.rb', line 525 def to_rbs "#{@base}[#{@type_args.map(&:to_rbs).join(', ')}]" end |
#to_trb ⇒ Object
529 530 531 |
# File 'lib/t_ruby/ir.rb', line 529 def to_trb "#{@base}<#{@type_args.map(&:to_trb).join(', ')}>" end |