Class: Axiom::Function::Connective::Negation

Inherits:
Axiom::Function::Connective show all
Includes:
Unary, Unary::Invertible
Defined in:
lib/axiom/function/connective/negation.rb

Overview

A logical negation of an expression

Defined Under Namespace

Modules: Methods

Instance Attribute Summary

Attributes included from Operation::Unary

#operand

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Unary

#call, #rename, #type

Methods included from Unary::Callable

#call, #included

Methods included from Operation::Unary

#initialize

Methods inherited from Axiom::Function::Connective

type

Methods inherited from Axiom::Function

extract_value, rename_attributes, #type

Methods included from Visitable

#accept

Class Method Details

.call(operand) ⇒ Boolean

Evaluate the operands using a logical NOT

Examples:

with true operand

Negation.call(true)  # => false

with false operand

Negation.call(false)  # => true

Parameters:

  • operand (Boolean)

Returns:

  • (Boolean)


38
39
40
# File 'lib/axiom/function/connective/negation.rb', line 38

def self.call(operand)
  !operand
end

.operationSymbol

Return the negation operation

Examples:

Negation.operation  # => :!

Returns:

  • (Symbol)


21
22
23
# File 'lib/axiom/function/connective/negation.rb', line 21

def self.operation
  :'!'
end

Instance Method Details

#inverseFunction

Return the operand

Examples:

operand = negation.inverse

Returns:



50
51
52
# File 'lib/axiom/function/connective/negation.rb', line 50

def inverse
  operand
end