Class: Typeguard::Validation::Union

Inherits:
Base
  • Object
show all
Defined in:
lib/typeguard/types.rb

Instance Method Summary collapse

Methods inherited from Base

from

Constructor Details

#initialize(node) ⇒ Union

Returns a new instance of Union.



126
127
128
# File 'lib/typeguard/types.rb', line 126

def initialize(node)
  @children = node.children.map { |child| Base.from(child) }
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/typeguard/types.rb', line 130

def valid?(value)
  @children.any? { |child| child.valid?(value) }
end