class SyntaxTree::Reflection::Type::TupleType

Represents a tuple type that holds a number of types in order.

Attributes

types[R]

Public Class Methods

new(types) click to toggle source
# File lib/syntax_tree/reflection.rb, line 34
def initialize(types)
  @types = types
end

Public Instance Methods

===(value) click to toggle source
# File lib/syntax_tree/reflection.rb, line 38
def ===(value)
  value.is_a?(Array) && value.length == types.length &&
    value.zip(types).all? { |item, type| type === item }
end
inspect() click to toggle source
# File lib/syntax_tree/reflection.rb, line 43
def inspect
  "[#{types.map(&:inspect).join(", ")}]"
end