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



18
19
20
# File 'lib/dry/logic/operations/negation.rb', line 18

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

#call(input) ⇒ Object



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

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

#typeObject



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

def type
  :not
end