Class: ConvenientService::Service::Plugins::RescuesResultUnhandledExceptions::Commands::FormatBacktrace Private
- Inherits:
-
ConvenientService::Support::Command
- Object
- ConvenientService::Support::Command
- ConvenientService::Service::Plugins::RescuesResultUnhandledExceptions::Commands::FormatBacktrace
- Defined in:
- lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #backtrace ⇒ Object readonly private
- #max_size ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ String private
- #initialize(backtrace:, max_size: Constants::DEFAULT_MAX_BACKTRACE_SIZE) ⇒ void constructor private
Methods inherited from ConvenientService::Support::Command
Constructor Details
#initialize(backtrace:, max_size: Constants::DEFAULT_MAX_BACKTRACE_SIZE) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb', line 36 def initialize(backtrace:, max_size: Constants::DEFAULT_MAX_BACKTRACE_SIZE) @backtrace = backtrace.to_a @max_size = max_size end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb', line 18 def backtrace @backtrace end |
#max_size ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb', line 24 def max_size @max_size end |
Instance Method Details
#call ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Exceptions formatting is inspired by RSpec. It has almost the same output (at least for RSpec 3).
73 74 75 76 77 78 79 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb', line 73 def call = backtrace.take(max_size).map { |line| Commands::FormatLine.call(line: line) }.join("\n") << "\n# ..." if backtrace.size > max_size end |