Make special locals available

This commit is contained in:
Conrad Irwin 2011-10-01 17:41:53 -07:00
parent c211912a72
commit 119d4a32e6
1 changed files with 15 additions and 7 deletions

View File

@ -129,13 +129,21 @@ class Pry
private :initialize_special_locals private :initialize_special_locals
def inject_special_locals(target) def inject_special_locals(target)
inject_local("_in_", @input_array, target) special_locals.each_pair do |name, value|
inject_local("_out_", @output_array, target) inject_local(name, value, target)
inject_local("_pry_", self, target) end
inject_local("_ex_", self.last_exception, target) end
inject_local("_file_", self.last_file, target)
inject_local("_dir_", self.last_dir, target) def special_locals
inject_local("_", self.last_result, target) {
:_in_ => @input_array,
:_out_ => @output_array,
:_pry_ => self,
:_ex_ => last_exception,
:_file_ => last_file,
:_dir_ => last_dir,
:_ => last_result
}
end end
# Initialize the repl session. # Initialize the repl session.