Module: Roger::Helpers::GetFiles
Overview
Helper to include the get_files method
Instance Method Summary collapse
-
#get_files(globs, excludes = [], path = nil) ⇒ Object
Get files from a path, skipping excludes.
Instance Method Details
#get_files(globs, excludes = [], path = nil) ⇒ Object
Get files from a path, skipping excludes.
12 13 14 15 16 17 |
# File 'lib/roger/helpers/get_files.rb', line 12 def get_files(globs, excludes = [], path = nil) path = Pathname.new(get_files_default_path) files = globs.map { |g| Dir.glob(path + g) }.flatten files.reject! { |file| excludes.detect { |e| file.match(e) } } if excludes.any? files.select { |file| File.file?(file) } end |