class Parlour::Types::Union

A type which is (at least) one of the wrapped types.

Attributes

types[R]

Public Class Methods

new(types) click to toggle source
# File lib/parlour/types.rb, line 109
def initialize(types)
  @types = types.map(&method(:to_type))
end

Public Instance Methods

==(other) click to toggle source
# File lib/parlour/types.rb, line 114
def ==(other)
  Union === other && types == other.types
end
describe() click to toggle source
# File lib/parlour/types.rb, line 132
def describe
  "Union<#{types.map(&:describe).join(', ')}>"
end
generate_rbi() click to toggle source
# File lib/parlour/types.rb, line 122
def generate_rbi
  "T.any(#{types.map(&:generate_rbi).join(', ')})"
end
generate_rbs() click to toggle source
# File lib/parlour/types.rb, line 127
def generate_rbs
  "(#{types.map(&:generate_rbs).join(' | ')})"
end