Module: Essence::Utils

Included in:
ApplicationComponent
Defined in:
lib/essence/utils.rb

Instance Method Summary collapse

Instance Method Details

#get_directory_file_names(directory, extension) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/essence/utils.rb', line 5

def get_directory_file_names(directory, extension)
  return [] unless Dir.exist?(directory)

  Dir.entries(directory)
     .select { |file| File.extname(file) == ".#{extension}" }
     .map { |file| File.basename(file, ".#{extension}") }
end