diff options
author | 0xAB <0xAB@protonmail.com> | 2017-08-31 09:44:35 +0100 |
---|---|---|
committer | 0xAB <0xAB@protonmail.com> | 2017-08-31 09:44:35 +0100 |
commit | 7e4d4a8b1fb51cf54630fe5b61a0c34cf0376d9d (patch) | |
tree | 31e31562830f3763712042fd5e92b747d045aca4 | |
parent | 6f5a7a93817534baeb9543bff6d5fa37dd07c7f1 (diff) | |
download | pry-7e4d4a8b1fb51cf54630fe5b61a0c34cf0376d9d.tar.gz |
make '_pry_' available in scope of calling functions.
-rw-r--r-- | lib/pry/pry_instance.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index d043a58c..949171fd 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -86,11 +86,15 @@ class Pry # Returns a module that includes basic utility helper functions. # def helpers - @helpers ||= Module.new { - include Pry::Helpers::Text - include Pry::Helpers::BaseHelpers - extend self - } + @helpers ||= lambda { + this = self + Module.new do + include Pry::Helpers::Text + include Pry::Helpers::BaseHelpers + define_method(:_pry_) { this } + extend self + end + }.call end # The current prompt. |