Class: ServiceOperation::Errors
- Inherits:
-
Hash
- Object
- Hash
- ServiceOperation::Errors
- Defined in:
- lib/service_operation/errors.rb
Overview
Error object with minimal compatibility with ActiveModel style errors
Instance Method Summary collapse
Instance Method Details
#add(attr, *args) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/service_operation/errors.rb', line 9 def add(attr, *args) return self if args.empty? self[attr] ||= [] self[attr] += args.flatten self end |
#coerced_merge(error_hash) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/service_operation/errors.rb', line 19 def coerced_merge(error_hash) ensure_error_hash(error_hash).each do |key, error| object_to_array(error).each { |errors| add(key, *errors) } end self end |