Sha256: 9246ce3041fd7c86697ff2d0f949e0fb5576264078294b0488810616ad18548d
Contents?: true
Size: 869 Bytes
Versions: 3
Compression:
Stored size: 869 Bytes
Contents
module Kharon module Handlers # Errors handler that stores each problem encountered during validation. # @author Vincent Courtois <courtois.vincent@outlook.com> class Messages # Constructor of the class, initializing the errors array. def initialize @errors = Array.new end # Method used to report an error by storing it in an array. # @param [Hash] error_hash a Hash describing the error. # @return [Kharon::Handlers::Messages] the errors handler after insertion, so several calls can be chained. def report_error(error_hash) @errors.push(error_hash) self end # Getter for the errors, cloning it so no error can be added from outside of the report_error method # @return [Array] the array of errors. def errors @errors.clone end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kharon-1.1.1 | lib/kharon/handlers/messages.rb |
kharon-1.1.0 | lib/kharon/handlers/messages.rb |
kharon-1.0.0 | lib/kharon/handlers/messages.rb |