Class: Eax::FileListing
- Inherits:
-
Object
- Object
- Eax::FileListing
- Defined in:
- lib/eax.rb
Class Method Summary collapse
-
.list_files_in(dir, hidden: false, parent_dir: true) ⇒ Object
List all items in a given directory
dir
is the directory in which to list the itemshidden
display hidden files.
Class Method Details
.list_files_in(dir, hidden: false, parent_dir: true) ⇒ Object
List all items in a given directory dir
is the directory in which to list the items hidden
display hidden files
12 13 14 15 16 17 18 |
# 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 |