Class: ElectionBuddy::Validation::ListError
- Inherits:
-
Object
- Object
- ElectionBuddy::Validation::ListError
- Defined in:
- lib/election_buddy/entities/validation/list_error.rb
Overview
Represents a single voter list validation error
Instance Attribute Summary collapse
-
#category ⇒ String
readonly
The category of the error.
-
#error ⇒ Hash
readonly
The raw error data.
-
#messages ⇒ Array<String>
readonly
The error messages.
Instance Method Summary collapse
-
#error_message ⇒ String
Returns a formatted error message.
-
#initialize(error) ⇒ ListError
constructor
A new instance of ListError.
Constructor Details
#initialize(error) ⇒ ListError
Returns a new instance of ListError.
24 25 26 27 |
# File 'lib/election_buddy/entities/validation/list_error.rb', line 24 def initialize(error) @error = error @category, @messages = error.first end |
Instance Attribute Details
#category ⇒ String (readonly)
Returns The category of the error.
18 19 20 |
# File 'lib/election_buddy/entities/validation/list_error.rb', line 18 def category @category end |
#error ⇒ Hash (readonly)
Returns The raw error data.
15 16 17 |
# File 'lib/election_buddy/entities/validation/list_error.rb', line 15 def error @error end |
#messages ⇒ Array<String> (readonly)
Returns The error messages.
21 22 23 |
# File 'lib/election_buddy/entities/validation/list_error.rb', line 21 def @messages end |
Instance Method Details
#error_message ⇒ String
Returns a formatted error message
32 33 34 |
# File 'lib/election_buddy/entities/validation/list_error.rb', line 32 def "#{category}: #{.join(", ")}" end |