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.
549 550 551 552 553 |
# File 'lib/t_ruby/ir.rb', line 549 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.
547 548 549 |
# File 'lib/t_ruby/ir.rb', line 547 def base @base end |
#type_args ⇒ Object
Returns the value of attribute type_args.
547 548 549 |
# File 'lib/t_ruby/ir.rb', line 547 def type_args @type_args end |
Instance Method Details
#to_rbs ⇒ Object
555 556 557 |
# File 'lib/t_ruby/ir.rb', line 555 def to_rbs "#{@base}[#{@type_args.map(&:to_rbs).join(", ")}]" end |
#to_trb ⇒ Object
559 560 561 |
# File 'lib/t_ruby/ir.rb', line 559 def to_trb "#{@base}<#{@type_args.map(&:to_trb).join(", ")}>" end |