Sha256: 384743becade11947c7f09334c24e976f2f41ffe38763ce58a5c4ae2913f5f08
Contents?: true
Size: 532 Bytes
Versions: 3
Compression:
Stored size: 532 Bytes
Contents
module FileTest module_function # Is a file a command executable? # TODO: Make more robust (Windows?) def bin?(fname) @command_paths ||= ENV['PATH'].split(/[:;]/) is_bin = @command_paths.any? do |f| FileTest.exist?(File.join(f, fname)) end #is_bin ? File.basename(fname) : false is_bin ? fname : false end # Is a path considered reasonably "safe"? # TODO: Make more robust. def safe?(path) case path when *[ '/', '/*', '/**/*' ] return false end true end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ratch-0.3.0 | lib/ratch/support/filetest.rb |
ratch-0.4.1 | lib/ratch/support/filetest.rb |
ratch-0.4.0 | lib/ratch/support/filetest.rb |