Class: Remap::Failure
- Inherits:
-
Dry::Concrete
- Object
- Dry::Concrete
- Remap::Failure
- Defined in:
- lib/remap/failure.rb
Instance Method Summary collapse
- #exception ⇒ String
-
#merge(other) ⇒ Failure
Merges two failures.
Instance Method Details
#exception ⇒ String
33 34 35 |
# File 'lib/remap/failure.rb', line 33 def exception Error.new(attributes.formated) end |
#merge(other) ⇒ Failure
Merges two failures
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/remap/failure.rb', line 15 def merge(other) unless other.is_a?(self.class) raise ArgumentError, "can't merge #{self.class} with #{other.class}" end failure = attributes.deep_merge(other.attributes) do |_, value1, value2| case [value1, value2] in [Array, Array] value1 + value2 else raise ArgumentError, "can't merge #{self.class} with #{other.class}" end end new(failure) end |