Class: Qless::FailureFormatter
- Inherits:
-
Object
- Object
- Qless::FailureFormatter
- Defined in:
- lib/qless/failure_formatter.rb
Overview
A helper for formatting failure messages
Defined Under Namespace
Classes: Failure
Instance Method Summary collapse
- #format(job, error, lines_to_remove = caller(2)) ⇒ Object
-
#initialize ⇒ FailureFormatter
constructor
A new instance of FailureFormatter.
Constructor Details
#initialize ⇒ FailureFormatter
Returns a new instance of FailureFormatter.
13 14 15 16 |
# File 'lib/qless/failure_formatter.rb', line 13 def initialize @replacements = { Dir.pwd => '.' } @replacements[ENV['GEM_HOME']] = '<GEM_HOME>' if ENV.key?('GEM_HOME') end |
Instance Method Details
#format(job, error, lines_to_remove = caller(2)) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/qless/failure_formatter.rb', line 18 def format(job, error, lines_to_remove = caller(2)) group = "#{job.klass_name}:#{error.class}" = "#{(error)}\n\n" + "#{format_failure_backtrace(error.backtrace, lines_to_remove)}" Failure.new(group, ) end |