Class: Polytrix::Validation
- Inherits:
-
ManifestSection
- Object
- Hashie::Dash
- Dash
- ManifestSection
- Polytrix::Validation
- Defined in:
- lib/polytrix/validation.rb
Constant Summary collapse
- ALLOWABLE_STATES =
TODO: Should we have (expectation) ‘failed’ vs (unexpected) ‘error’?
%w(passed pending failed skipped)
Instance Method Summary collapse
-
#error_source ⇒ Object
Gets the source of the validation code block where a ValidationFailure occurred.
- #result=(state) ⇒ Object
Methods inherited from Dash
Constructor Details
This class inherits a constructor from Polytrix::Dash
Instance Method Details
#error_source ⇒ Object
Gets the source of the validation code block where a ValidationFailure occurred.
24 25 26 27 |
# File 'lib/polytrix/validation.rb', line 24 def error_source return nil if error.nil? source_from_error(error) end |
#result=(state) ⇒ Object
11 12 13 14 15 |
# File 'lib/polytrix/validation.rb', line 11 def result=(state) state = state.to_s fail invalidate_state_error unless ALLOWABLE_STATES.include? state super end |