Class: Yoda::Typing::Types::Tuple
- Defined in:
- lib/yoda/typing/types/tuple.rb
Instance Attribute Summary collapse
- #types ⇒ Array<Base> readonly
Instance Method Summary collapse
-
#initialize(*types) ⇒ Tuple
constructor
A new instance of Tuple.
- #to_expression ⇒ Object
- #to_type_string ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*types) ⇒ Tuple
Returns a new instance of Tuple.
9 10 11 |
# File 'lib/yoda/typing/types/tuple.rb', line 9 def initialize(*types) @types = types end |
Instance Attribute Details
#types ⇒ Array<Base> (readonly)
6 7 8 |
# File 'lib/yoda/typing/types/tuple.rb', line 6 def types @types end |
Instance Method Details
#to_expression ⇒ Object
13 14 15 |
# File 'lib/yoda/typing/types/tuple.rb', line 13 def to_expression Model::TypeExpressions::InstanceType.new('Array') end |
#to_type_string ⇒ Object
17 18 19 20 |
# File 'lib/yoda/typing/types/tuple.rb', line 17 def to_type_string inner = types.map(&:to_type_string) "(#{inner.join(', ')})" end |