Class: Dry::Logic::Operations::Negation

Inherits:
Unary show all
Defined in:
lib/dry/logic/operations/negation.rb

Instance Attribute Summary

Attributes inherited from Unary

#rule

Attributes inherited from Abstract

#options, #rules

Instance Method Summary collapse

Methods inherited from Unary

#ast, #initialize, #to_s

Methods inherited from Abstract

#curry, #id, #initialize, #new, #to_ast, #with

Methods included from Dry::Logic::Operators

#and, #or, #then, #xor

Constructor Details

This class inherits a constructor from Dry::Logic::Operations::Unary

Instance Method Details

#[](input) ⇒ Object



15
16
17
# File 'lib/dry/logic/operations/negation.rb', line 15

def [](input)
  !rule[input]
end

#call(input) ⇒ Object



11
12
13
# File 'lib/dry/logic/operations/negation.rb', line 11

def call(input)
  Result.new(rule.(input).failure?, id) { ast(input) }
end

#typeObject



7
8
9
# File 'lib/dry/logic/operations/negation.rb', line 7

def type
  :not
end