Class: Which::Base
Class Method Summary collapse
- .exe(path = find) ⇒ Object (also: bat)
- .exist?(path) ⇒ Boolean
- .find(search_path = ENV['PATH']) ⇒ Object
- .glob(path) ⇒ Object
Class Method Details
.exe(path = find) ⇒ Object Also known as: bat
17 18 19 |
# File 'lib/pik/which.rb', line 17 def exe(path=find) glob(path).first end |
.exist?(path) ⇒ Boolean
13 14 15 |
# File 'lib/pik/which.rb', line 13 def exist?(path) !!exe(path) end |
.find(search_path = ENV['PATH']) ⇒ Object
7 8 9 10 11 |
# File 'lib/pik/which.rb', line 7 def find(search_path=ENV['PATH']) path = SearchPath.new(search_path) path = path.find{|dir| exist?(dir)} Pathname(path) rescue nil end |