lib/metaractor/failure_output.rb in metaractor-2.1.1 vs lib/metaractor/failure_output.rb in metaractor-3.0.0
- old
+ new
@@ -1,25 +1,13 @@
module Metaractor
module FailureOutput
- def self.format_hash(hash)
- if @hash_formatter.nil?
- @hash_formatter = ->(hash){ hash.inspect }
- end
-
- @hash_formatter.call(hash)
- end
-
- def self.hash_formatter=(callable)
- @hash_formatter = callable
- end
-
def to_s
str = ''
if !context.errors.empty?
str << "Errors:\n"
- str << Metaractor::FailureOutput.format_hash(context.errors.to_h)
+ str << Metaractor.format_hash(context.errors.to_h)
str << "\n\n"
end
if !context._called.empty?
str << "Previously Called:\n"
@@ -29,10 +17,10 @@
end
str << "\n"
end
str << "Context:\n"
- str << Metaractor::FailureOutput.format_hash(context.to_h.reject{|k,_| k == :errors})
+ str << Metaractor.format_hash(context.to_h.reject{|k,_| k == :errors})
str
end
end
end