Class: Dry::Logic::Rule::Key

Inherits:
Dry::Logic::Rule show all
Defined in:
lib/dry/logic/rule/key.rb

Instance Attribute Summary

Attributes inherited from Dry::Logic::Rule

#name, #predicate

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dry::Logic::Rule

#and, #curry, #initialize, #negation, #new, #or, #predicate_id, #then, #to_ary, #xor

Constructor Details

This class inherits a constructor from Dry::Logic::Rule

Class Method Details

.new(name, predicate) ⇒ Object



4
5
6
# File 'lib/dry/logic/rule/key.rb', line 4

def self.new(name, predicate)
  super(name, predicate.curry(name))
end

Instance Method Details

#call(input) ⇒ Object



12
13
14
# File 'lib/dry/logic/rule/key.rb', line 12

def call(input)
  Logic.Result(input[name], predicate.(input), self)
end

#typeObject



8
9
10
# File 'lib/dry/logic/rule/key.rb', line 8

def type
  :key
end