class Pry::Method::Patcher

def with_method_transaction


continue to work.
translation we make that not happen, which means that alias_method_chains, etc.
unaliased name (so that super continues to work). By wrapping that code in a
When we're redefining aliased methods we will overwrite the method at the

Run some code ensuring that at the end target#meth_name will not have changed.
def with_method_transaction
  temp_name = "__pry_#{method.original_name}__"
  method = self.method
  method.owner.class_eval do
    alias_method temp_name, method.original_name
    yield
    alias_method method.name, method.original_name
    alias_method method.original_name, temp_name
  end
ensure
  begin
    method.send(:remove_method, temp_name)
  rescue StandardError
    nil
  end
end