Class: Form::ActiveModel::Validations::Result
- Inherits:
-
Hash
- Object
- Hash
- Form::ActiveModel::Validations::Result
- Defined in:
- lib/reform/form/active_model/validations.rb
Overview
The idea here to mimic Dry.RB’s Result API.
Defined Under Namespace
Classes: ResultErrors
Instance Method Summary collapse
-
#errors ⇒ Object
DISCUSS @FRAN: not sure this is 100% compatible with AMV::Errors?.
- #failure? ⇒ Boolean
-
#initialize(success, hash) ⇒ Result
constructor
FIXME; should this be AMV::Errors?.
- #messages ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(success, hash) ⇒ Result
FIXME; should this be AMV::Errors?
101 102 103 104 105 |
# File 'lib/reform/form/active_model/validations.rb', line 101 def initialize(success, hash) super() @success = success hash.each { |k,v| self[k] = v } end |
Instance Method Details
#errors ⇒ Object
DISCUSS @FRAN: not sure this is 100% compatible with AMV::Errors?
120 121 122 |
# File 'lib/reform/form/active_model/validations.rb', line 120 def errors self end |
#failure? ⇒ Boolean
111 112 113 |
# File 'lib/reform/form/active_model/validations.rb', line 111 def failure? ! success? end |
#messages ⇒ Object
115 116 117 |
# File 'lib/reform/form/active_model/validations.rb', line 115 def self end |
#success? ⇒ Boolean
107 108 109 |
# File 'lib/reform/form/active_model/validations.rb', line 107 def success? @success end |