class Eax::FileListing

Public Class Methods

list_files_in(dir, hidden: false, parent_dir: true) click to toggle source

List all items in a given directory dir is the directory in which to list the items hidden display hidden files

# File lib/eax.rb, line 12
def self.list_files_in(dir, hidden: false, parent_dir: true)
  args = [File.join(dir, '*')]
  args << File::FNM_DOTMATCH if hidden
  files = Dir.glob(*args)
  files.reject! { |file| file.end_with? '.' or file.end_with? '..' } if parent_dir
  files
end