Class: Lapsoss::ExceptionBacktraceFrame
- Inherits:
-
Object
- Object
- Lapsoss::ExceptionBacktraceFrame
- Defined in:
- lib/lapsoss/exception_backtrace_frame.rb
Overview
Wrapper for BacktraceFrame that adds exception-specific metadata
Instance Attribute Summary collapse
-
#exception_class ⇒ Object
readonly
Returns the value of attribute exception_class.
-
#frame ⇒ Object
readonly
Returns the value of attribute frame.
-
#is_crash_frame ⇒ Object
readonly
Returns the value of attribute is_crash_frame.
Instance Method Summary collapse
- #crash_frame? ⇒ Boolean
-
#initialize(frame, exception_class: nil, is_crash_frame: false) ⇒ ExceptionBacktraceFrame
constructor
A new instance of ExceptionBacktraceFrame.
-
#method_missing(method) ⇒ Object
Delegate all other methods to the wrapped frame.
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
-
#to_h ⇒ Object
Override to_h to include exception metadata.
Constructor Details
#initialize(frame, exception_class: nil, is_crash_frame: false) ⇒ ExceptionBacktraceFrame
Returns a new instance of ExceptionBacktraceFrame.
8 9 10 11 12 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 8 def initialize(frame, exception_class: nil, is_crash_frame: false) @frame = frame @exception_class = exception_class @is_crash_frame = is_crash_frame end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
Delegate all other methods to the wrapped frame
19 20 21 22 23 24 25 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 19 def method_missing(method, *, &) if @frame.respond_to?(method) @frame.send(method, *, &) else super end end |
Instance Attribute Details
#exception_class ⇒ Object (readonly)
Returns the value of attribute exception_class.
6 7 8 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 6 def exception_class @exception_class end |
#frame ⇒ Object (readonly)
Returns the value of attribute frame.
6 7 8 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 6 def frame @frame end |
#is_crash_frame ⇒ Object (readonly)
Returns the value of attribute is_crash_frame.
6 7 8 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 6 def is_crash_frame @is_crash_frame end |
Instance Method Details
#crash_frame? ⇒ Boolean
14 15 16 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 14 def crash_frame? @is_crash_frame end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
27 28 29 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 27 def respond_to_missing?(method, include_private = false) @frame.respond_to?(method, include_private) || super end |
#to_h ⇒ Object
Override to_h to include exception metadata
32 33 34 35 36 37 |
# File 'lib/lapsoss/exception_backtrace_frame.rb', line 32 def to_h @frame.to_h.merge( exception_class: @exception_class, crash_frame: @is_crash_frame ).compact end |