Ratch  FileTest

[Validate]
Generated with Newfish 0.1.0

FileTest

Public Instance Methods

bin?(fname) click to toggle source

Is a file a bin/ executable?

TODO: Make more robust. Probably needs to be fixed for Windows.

    # File lib/ratch/core_ext/filetest.rb, line 12
12:   def bin?(fname)
13:     is_bin = command_paths.any? do |f|
14:       FileTest.exist?(File.join(f, fname))
15:     end
16:     #is_bin ? File.basename(fname) : false
17:     is_bin ? fname : false
18:   end
command_paths() click to toggle source

Return a cached list of the PATH environment variable. This is a support method used by bin?

   # File lib/ratch/core_ext/filetest.rb, line 5
5:   def command_paths
6:     @command_paths ||= ENV['PATH'].split(/[:;]/)
7:   end

Disabled; run with --debug to generate this.