Class: Kharon::Handlers::Messages
- Inherits:
-
Object
- Object
- Kharon::Handlers::Messages
- Defined in:
- lib/kharon/handlers/messages.rb
Overview
Errors handler that stores each problem encountered during validation.
Instance Method Summary (collapse)
-
- (Array) errors
Getter for the errors, cloning it so no error can be added from outside of the report_error method.
-
- (Messages) initialize
constructor
Constructor of the class, initializing the errors array.
-
- (Kharon::Handlers::Messages) report_error(error_hash)
Method used to report an error by storing it in an array.
Constructor Details
- (Messages) initialize
Constructor of the class, initializing the errors array.
9 10 11 |
# File 'lib/kharon/handlers/messages.rb', line 9 def initialize @errors = Array.new end |
Instance Method Details
- (Array) errors
Getter for the errors, cloning it so no error can be added from outside of the report_error method
23 24 25 |
# File 'lib/kharon/handlers/messages.rb', line 23 def errors @errors.clone end |
- (Kharon::Handlers::Messages) report_error(error_hash)
Method used to report an error by storing it in an array.
16 17 18 19 |
# File 'lib/kharon/handlers/messages.rb', line 16 def report_error(error_hash) @errors.push(error_hash) self end |