Class: NRSER::Types::Not

Inherits:
Type show all
Defined in:
lib/nrser/types/not.rb

Overview

Note:

Construct Not types using the Not factory.

Negation Type - A Type that parameterizes another #type by admitting values that the #type does not.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

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

Constructor Details

#initialize(type, **options) ⇒ Not

Instantiate a new ‘NRSER::Types::Not`.



42
43
44
45
# File 'lib/nrser/types/not.rb', line 42

def initialize type, **options
  super **options
  @type = NRSER::Types.make type
end

Instance Attribute Details

#typeType (readonly)

The type this one isn’t.

Returns:



35
36
37
# File 'lib/nrser/types/not.rb', line 35

def type
  @type
end

Instance Method Details

#default_nameObject



61
62
63
# File 'lib/nrser/types/not.rb', line 61

def default_name
  "#{ NOT }#{ type.name }"
end

#default_symbolicObject



56
57
58
# File 'lib/nrser/types/not.rb', line 56

def default_symbolic
  "#{ NRSER::Types.Top.symbolic }#{ COMPLEMENT }#{ type.symbolic }"
end

#explainObject



66
67
68
# File 'lib/nrser/types/not.rb', line 66

def explain
  "#{ self.class.demod_name }<#{ type.explain }>"
end

#test?(value) ⇒ Boolean

Instance Methods

Returns:



51
52
53
# File 'lib/nrser/types/not.rb', line 51

def test? value
  ! type.test( value )
end