Class: Lite::Validation::Validator::Result::Refuted

Inherits:
Abstract::Instance show all
Includes:
Abstract::Failure
Defined in:
lib/lite/validation/validator/result/refuted.rb

Constant Summary

Constants included from Abstract

Abstract::EMPTY

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Abstract::Failure

#to_failure

Methods included from Result::Abstract::Failure

#failure?, #to_result

Methods included from Result::Abstract

#success?

Class Method Details

.instance(error, *args, fall_through: false) ⇒ Object

Raises:



15
16
17
18
19
# File 'lib/lite/validation/validator/result/refuted.rb', line 15

def self.instance(error, *args, fall_through: false)
  raise Error::Fatal, "Structured error expected, got: #{error.inspect}" unless error.is_a?(StructuredError)

  new(error, *args, fall_through: fall_through)
end

Instance Method Details

#auto_commit(as:) ⇒ Object



39
40
41
# File 'lib/lite/validation/validator/result/refuted.rb', line 39

def auto_commit(as:)
  self
end

#childrenObject



67
68
69
# File 'lib/lite/validation/validator/result/refuted.rb', line 67

def children
  EMPTY
end

#commit(_value) ⇒ Object



35
36
37
# File 'lib/lite/validation/validator/result/refuted.rb', line 35

def commit(_value)
  self
end

#committed?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/lite/validation/validator/result/refuted.rb', line 27

def committed?
  false
end

#dispute(error) ⇒ Object

Raises:



43
44
45
46
47
# File 'lib/lite/validation/validator/result/refuted.rb', line 43

def dispute(error)
  raise Error, "Structured error expected, got: #{error.inspect}" unless error.is_a?(StructuredError)

  self
end

#errors_rootObject



63
64
65
# File 'lib/lite/validation/validator/result/refuted.rb', line 63

def errors_root
  [error]
end

#inspectObject



71
72
73
# File 'lib/lite/validation/validator/result/refuted.rb', line 71

def inspect
  signature('Refuted', "error=#{error.code}")
end


55
56
57
# File 'lib/lite/validation/validator/result/refuted.rb', line 55

def navigable
  self
end


59
60
61
# File 'lib/lite/validation/validator/result/refuted.rb', line 59

def navigate(*_path, &_block)
  self
end

#refute(error) ⇒ Object

Raises:



49
50
51
52
53
# File 'lib/lite/validation/validator/result/refuted.rb', line 49

def refute(error)
  raise Error::Fatal, "Structured error expected, got: #{error.inspect}" unless error.is_a?(StructuredError)

  self
end

#refuted?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/lite/validation/validator/result/refuted.rb', line 31

def refuted?
  true
end

#success_at?(*_path) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/lite/validation/validator/result/refuted.rb', line 23

def success_at?(*_path)
  false
end