def executable_file?(filename, dir = nil)
      path = ::File.join(dir, filename) if dir
      path ||= filename
      ::File.file?(path) && ::File.executable?(path)
    end
def executable_file?(filename, dir = nil)
      path = ::File.join(dir, filename) if dir
      path ||= filename
      ::File.file?(path) && ::File.executable?(path)
    end
Determines if filename is an executable file

 @example Basic usage
   executable_file?('/usr/bin/less') # => true

 @example Executable in directory
   executable_file?('less', '/usr/bin') # => true
   executable_file?('less', '/usr') # => false

 @param [String] filename
   the path to file
 @param [String] dir
   the directory within which to search for filename

 @return [Boolean]

 @api private