Class: Dry::Logic::Result::Named

Inherits:
Value show all
Defined in:
lib/dry/logic/result/named.rb

Instance Attribute Summary

Attributes inherited from Dry::Logic::Result

#input, #response, #rule, #success

Instance Method Summary collapse

Methods inherited from Dry::Logic::Result

[], #[], #failure?, #initialize, #negated, #success?

Constructor Details

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

Instance Method Details

#nameObject



4
5
6
# File 'lib/dry/logic/result/named.rb', line 4

def name
  rule.name
end

#to_astObject



8
9
10
11
12
13
14
# File 'lib/dry/logic/result/named.rb', line 8

def to_ast
  if response.respond_to?(:to_ast) && !response.is_a?(Result)
    response.to_ast
  else
    [:input, [rule.name, super]]
  end
end