Class: Pry::Command::Edit::ExceptionPatcher
- Defined in:
- lib/pry/commands/edit/exception_patcher.rb
Instance Attribute Summary collapse
-
#_pry_ ⇒ Object
Returns the value of attribute pry.
-
#file_and_line ⇒ Object
Returns the value of attribute file_and_line.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(_pry_, state, exception_file_and_line) ⇒ ExceptionPatcher
constructor
A new instance of ExceptionPatcher.
-
#perform_patch ⇒ Object
perform the patch.
Constructor Details
#initialize(_pry_, state, exception_file_and_line) ⇒ ExceptionPatcher
Returns a new instance of ExceptionPatcher.
8 9 10 11 12 |
# File 'lib/pry/commands/edit/exception_patcher.rb', line 8 def initialize(_pry_, state, exception_file_and_line) @_pry_ = _pry_ @state = state @file_and_line = exception_file_and_line end |
Instance Attribute Details
#_pry_ ⇒ Object
Returns the value of attribute pry.
4 5 6 |
# File 'lib/pry/commands/edit/exception_patcher.rb', line 4 def _pry_ @_pry_ end |
#file_and_line ⇒ Object
Returns the value of attribute file_and_line.
6 7 8 |
# File 'lib/pry/commands/edit/exception_patcher.rb', line 6 def file_and_line @file_and_line end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/pry/commands/edit/exception_patcher.rb', line 5 def state @state end |
Instance Method Details
#perform_patch ⇒ Object
perform the patch
15 16 17 18 19 20 21 22 |
# File 'lib/pry/commands/edit/exception_patcher.rb', line 15 def perform_patch file_name, _ = file_and_line lines = state.dynamical_ex_file || File.read(file_name) source = Pry::Editor.new(_pry_).edit_tempfile_with_content(lines) _pry_.evaluate_ruby source state.dynamical_ex_file = source.split("\n") end |