Class: Dry::Logic::Rule::Result

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

Instance Attribute Summary

Attributes inherited from Dry::Logic::Rule

#name, #predicate

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

Instance Method Details

#call(input) ⇒ Object



4
5
6
7
8
9
# File 'lib/dry/logic/rule/result.rb', line 4

def call(input)
  result = input[name]
  return result unless result.success?
  result_input = result.input
  Result::Wrapped.new(input, predicate.(result_input), self)
end

#typeObject



11
12
13
# File 'lib/dry/logic/rule/result.rb', line 11

def type
  :res
end