Class: Yoda::Typing::Types::Generic
- Defined in:
- lib/yoda/typing/types/generic.rb
Instance Attribute Summary collapse
- #base ⇒ Base readonly
- #type_args ⇒ Array<Base> readonly
Instance Method Summary collapse
-
#initialize(base:, type_args:) ⇒ Generic
constructor
A new instance of Generic.
- #to_expression ⇒ Object
- #to_type_string ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(base:, type_args:) ⇒ Generic
Returns a new instance of Generic.
13 14 15 16 |
# File 'lib/yoda/typing/types/generic.rb', line 13 def initialize(base:, type_args:) @base = base @type_args = type_args end |
Instance Attribute Details
#type_args ⇒ Array<Base> (readonly)
9 10 11 |
# File 'lib/yoda/typing/types/generic.rb', line 9 def type_args @type_args end |
Instance Method Details
#to_expression ⇒ Object
18 19 20 |
# File 'lib/yoda/typing/types/generic.rb', line 18 def to_expression base.to_expression end |
#to_type_string ⇒ Object
22 23 24 25 |
# File 'lib/yoda/typing/types/generic.rb', line 22 def to_type_string inner = type_args.map(&:to_type_string) "#{base.to_type_string}<#{inner.join(', ')}>" end |