Class: ConvenientService::Service::Plugins::RescuesResultUnhandledExceptions::Commands::FormatCause
- Inherits:
-
ConvenientService::Support::Command
- Object
- ConvenientService::Support::Command
- ConvenientService::Service::Plugins::RescuesResultUnhandledExceptions::Commands::FormatCause
- Defined in:
- lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_cause.rb
Instance Attribute Summary collapse
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
- #exception ⇒ StandardError? readonly
Instance Method Summary collapse
- #call ⇒ String
- #initialize(cause:) ⇒ void constructor
Methods inherited from ConvenientService::Support::Command
Constructor Details
#initialize(cause:) ⇒ void
19 20 21 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_cause.rb', line 19 def initialize(cause:) @cause = cause end |
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
13 14 15 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_cause.rb', line 13 def cause @cause end |
#exception ⇒ StandardError? (readonly)
13 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_cause.rb', line 13 attr_reader :cause |
Instance Method Details
#call ⇒ String
Note:
Cause formatting is inspired by RSpec. It has almost the same output (at least for RSpec 3).
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_cause.rb', line 36 def call return "" unless cause <<~MESSAGE.chomp ------------------ --- Caused by: --- #{formatted_cause_class} #{} #{formatted_cause_first_line} MESSAGE end |