Skip to content

Instantly share code, notes, and snippets.

@epitron
Last active January 1, 2016 16:09
Show Gist options
  • Save epitron/8169266 to your computer and use it in GitHub Desktop.
Save epitron/8169266 to your computer and use it in GitHub Desktop.
Gives Pry _1, _2, _3, etc. variables (`_n` is equivalent to `_out_[n]`).
require 'binding_of_caller'
class Object
def method_missing(name, *args)
if name =~ /^_(\d+)$/
binding.of_caller(2).eval("self").output_array[$1.to_i]
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment