1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

added not_a_real_file? helper to BaseHelpers

* Useful for 'whereami' command and other commands that need to check whether file name was actually "<main>" or "(eval)" and so on
This commit is contained in:
John Mair 2012-02-09 15:55:51 +13:00
parent e83241e41e
commit f501090282

View file

@ -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 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 end
def not_a_real_file?(file)
file =~ /(\(.*\))|<.*>/ || file =~ /__unknown__/ || file == "" || file == "-e"
end
def command_dependencies_met?(options) def command_dependencies_met?(options)
return true if !options[:requires_gem] return true if !options[:requires_gem]
Array(options[:requires_gem]).all? do |g| Array(options[:requires_gem]).all? do |g|