Class: Yard2steep::Type::UnionType

Inherits:
TypeBase
  • Object
show all
Defined in:
lib/yard2steep/type/ast.rb

Instance Method Summary collapse

Constructor Details

#initialize(types:) ⇒ UnionType

Returns a new instance of UnionType.



54
55
56
57
# File 'lib/yard2steep/type/ast.rb', line 54

def initialize(types:)
  Util.assert! { types.size > 0 }
  @types = types
end

Instance Method Details

#to_sString

Returns:

  • (String)


60
61
62
# File 'lib/yard2steep/type/ast.rb', line 60

def to_s
  @types.map { |t| t.to_s }.uniq.join(' | ')
end