From f501090282bb40a24fae6710ebc259d2919b8347 Mon Sep 17 00:00:00 2001 From: John Mair Date: Thu, 9 Feb 2012 15:55:51 +1300 Subject: [PATCH] added not_a_real_file? helper to BaseHelpers * Useful for 'whereami' command and other commands that need to check whether file name was actually "
" or "(eval)" and so on --- lib/pry/helpers/base_helpers.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pry/helpers/base_helpers.rb b/lib/pry/helpers/base_helpers.rb index 45aed5bf..ff2932f5 100644 --- a/lib/pry/helpers/base_helpers.rb +++ b/lib/pry/helpers/base_helpers.rb @@ -27,6 +27,10 @@ class Pry Gem::Specification.respond_to?(:find_all_by_name) ? !Gem::Specification.find_all_by_name(gem_name).empty? : Gem.source_index.find_name(gem_name).first end + def not_a_real_file?(file) + file =~ /(\(.*\))|<.*>/ || file =~ /__unknown__/ || file == "" || file == "-e" + end + def command_dependencies_met?(options) return true if !options[:requires_gem] Array(options[:requires_gem]).all? do |g|