Module: Metaractor::FailFromContext

Defined in:
lib/metaractor/fail_from_context.rb

Instance Method Summary collapse

Instance Method Details

#fail_from_context(context:) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/metaractor/fail_from_context.rb', line 3

def fail_from_context(context:)
  return if context.equal?(self)

  invalidate! if context.invalid?
  add_errors(errors: context.errors.to_h)
  @failure = true
end