Class: NRSER::Types::Union

Inherits:
Combinator show all
Defined in:
lib/nrser/types/combinators.rb

Overview

Union combinator. (‘union`, `one_of`, `or`, `|`).

Constant Summary collapse

JOIN_SYMBOL =

‘ ⋁ ’

' | '

Instance Attribute Summary

Attributes inherited from Combinator

#types

Instance Method Summary collapse

Methods inherited from Combinator

#==, #custom_from_s, #default_symbolic, #explain, #from_data, #has_from_data?, #has_from_s?, #has_to_data?, #initialize, #string_format, #to_data

Methods inherited from Type

#===, #builtin_inspect, #check, #check!, #default_name, #default_symbolic, #explain, #from_data, #from_s, #has_from_data?, #has_from_s?, #has_to_data?, #initialize, #inspect, #intersection, #name, #not, #respond_to?, #symbolic, #test, #to_data, #to_proc, #to_s, #union, #xor

Constructor Details

This class inherits a constructor from NRSER::Types::Combinator

Instance Method Details

#test?(value) ⇒ Boolean

Returns:



216
217
218
# File 'lib/nrser/types/combinators.rb', line 216

def test? value
  @types.any? { |type| type.test value }
end