Class: Pry::LastException
- Inherits:
- BasicObject
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb
Instance Attribute Summary collapse
-
#bt_index ⇒ Object
Returns the value of attribute bt_index.
-
#file ⇒ String
readonly
Returns the path to a file for the current backtrace.
-
#line ⇒ Fixnum
readonly
Returns the line for the current backtrace.
Instance Method Summary collapse
- #bt_source_location_for(index) ⇒ Object
- #inc_bt_index ⇒ Object
-
#initialize(exception) ⇒ LastException
constructor
A new instance of LastException.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, include_all = false) ⇒ Boolean
-
#wrapped_exception ⇒ Exception
Returns the wrapped exception.
Methods included from Kernel
blank_slate_method_added, #class_eval, concern, #double_late_addition, enable_warnings, #late_addition, method_added, preload_method_added, silence_warnings, suppress, with_warnings
Methods included from LateKernel
Constructor Details
#initialize(exception) ⇒ LastException
Returns a new instance of LastException.
15 16 17 18 19 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 15 def initialize(exception) @exception = exception @bt_index = 0 @file, @line = bt_source_location_for(0) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 21 def method_missing(name, *args, &block) if @exception.respond_to?(name) @exception.public_send(name, *args, &block) else super end end |
Instance Attribute Details
#bt_index ⇒ Object
Returns the value of attribute bt_index.
13 14 15 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 13 def bt_index @bt_index end |
Instance Method Details
#bt_source_location_for(index) ⇒ Object
52 53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 52 def bt_source_location_for(index) backtrace[index] =~ /(.*):(\d+)/ [::Regexp.last_match(1), ::Regexp.last_match(2).to_i] end |
#inc_bt_index ⇒ Object
57 58 59 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 57 def inc_bt_index @bt_index = (@bt_index + 1) % backtrace.size end |
#respond_to_missing?(name, include_all = false) ⇒ Boolean
29 30 31 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 29 def respond_to_missing?(name, include_all = false) @exception.respond_to?(name, include_all) end |
#wrapped_exception ⇒ Exception
Returns the wrapped exception
48 49 50 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/last_exception.rb', line 48 def wrapped_exception @exception end |