Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/upm/core_ext.rb
Class Method Summary collapse
Class Method Details
.which(bin) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/upm/core_ext.rb', line 8 def self.which(bin) ENV["PATH"].split(":").each do |dir| full_path = File.join(dir, bin) return full_path if File.exists? full_path end nil end |
.which_is_best?(*bins) ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/upm/core_ext.rb', line 16 def self.which_is_best?(*bins) bins.flatten.each do |bin| if location = which(bin) return location end end nil end |