Method: Backup::FileItem::Local#dir

Defined in:
lib/backup/file_item/local.rb

#dir(path, mask = "*") ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/backup/file_item/local.rb', line 38

def dir path, mask = "*"
  r_mask = mask.gsub('.', '\.').gsub('*', '[^\/]')

  Dir["#{path}/#{mask}"].map do |item|
    match = item.match(/^#{path}\/([^\/]+#{r_mask}).*$/)
    match[1] if match
  end.compact.uniq
end