Sha256: 44cb8feee139aa1d3300f0115400b4732242be794e488d220696af1ec9ebe35e

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 Bytes

Contents

module Metaractor
  module FailureOutput
    def to_s
      str = ""

      if !context.errors.empty?
        str << "Errors:\n"
        str << Metaractor.format_hash(context.errors.to_h)
        str << "\n\n"
      end

      if !context._called.empty?
        str << "Previously Called:\n"
        context._called.each do |interactor|
          str << interactor.class.name.to_s
          str << "\n"
        end
        str << "\n"
      end

      str << "Context:\n"
      str << Metaractor.format_hash(context.to_h.except(:errors))
      str
    end
  end
end

Interactor::Failure.send(:include, Metaractor::FailureOutput)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metaractor-3.3.4 lib/metaractor/failure_output.rb
metaractor-3.3.3 lib/metaractor/failure_output.rb
metaractor-3.3.2 lib/metaractor/failure_output.rb