Method: Hoodoo::Errors#merge!
- Defined in:
- lib/hoodoo/errors/errors.rb
#merge!(source) ⇒ Object
Merge the contents of a source error object with this one, adding its errors to this collection. No checks are made for duplicates (in part because, depending on error code and source/target contexts, a duplicate may be a valid thing to have).
source
-
Hoodoo::Errors instance to merge into the error collection of ‘this’ target object.
Returns true
if errors were merged, else false
(the source collection was empty).
202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/hoodoo/errors/errors.rb', line 202 def merge!( source ) source_errors = source.errors source_errors.each do | hash | add_precompiled_error( hash[ 'code' ], hash[ 'message' ], hash[ 'reference' ], source.http_status_code ) end return ! source_errors.empty? end |