Class: Pry::Command::Cat::ExceptionFormatter
- Inherits:
-
AbstractFormatter
- Object
- AbstractFormatter
- Pry::Command::Cat::ExceptionFormatter
- Includes:
- Helpers::Text
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb
Constant Summary
Constants included from Helpers::Text
Instance Attribute Summary collapse
-
#ex ⇒ Object
readonly
Returns the value of attribute ex.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#pry_instance ⇒ Object
readonly
Returns the value of attribute pry_instance.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(exception, pry_instance, opts) ⇒ ExceptionFormatter
constructor
A new instance of ExceptionFormatter.
Methods included from Helpers::Text
#bold, #default, #indent, #no_color, #no_pager, #strip_color, #with_line_numbers
Methods included from Helpers::BaseHelpers
#colorize_code, #find_command, #heading, #highlight, #not_a_real_file?, #safe_send, #silence_warnings, #stagger_output, #use_ansi_codes?
Methods included from Helpers::CommandHelpers
#absolute_index_number, #absolute_index_range, #get_method_or_raise, #internal_binding?, #one_index_number, #one_index_range, #one_index_range_or_number, #restrict_to_lines, #set_file_and_dir_locals, #temp_file, #unindent
Methods included from Helpers::OptionsHelpers
Constructor Details
#initialize(exception, pry_instance, opts) ⇒ ExceptionFormatter
Returns a new instance of ExceptionFormatter.
12 13 14 15 16 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb', line 12 def initialize(exception, pry_instance, opts) @ex = exception @opts = opts @pry_instance = pry_instance end |
Instance Attribute Details
#ex ⇒ Object (readonly)
Returns the value of attribute ex.
7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb', line 7 def ex @ex end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
8 9 10 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb', line 8 def opts @opts end |
#pry_instance ⇒ Object (readonly)
Returns the value of attribute pry_instance.
9 10 11 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb', line 9 def pry_instance @pry_instance end |
Instance Method Details
#format ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/commands/cat/exception_formatter.rb', line 18 def format check_for_errors set_file_and_dir_locals( backtrace_file, pry_instance, pry_instance.current_context ) code = decorate( Pry::Code.from_file(backtrace_file) .between(*start_and_end_line_for_code_window) .with_marker(backtrace_line) ) "#{header}#{code}" end |