Class: NRSER::Types::XOR

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

Overview

XOR combinator - Exclusive Or (‘xor`).

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:



238
239
240
# File 'lib/nrser/types/combinators.rb', line 238

def test? value
  @types.count { |type| type === value } == 1
end