Class: Grandfather::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/grandfather/path.rb

Class Method Summary collapse

Class Method Details

.list_valid(target, recursive = false) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/grandfather/path.rb', line 7

def self.list_valid(target, recursive = false)
  if recursive
    target ||= Dir.pwd
    if File.directory?(target)
      target = File.join(target, '**', '*')
    end
  else
    target ||= Dir.pwd
    if File.directory?(target)
      target = File.join(target, '*')
    end
  end

  @what = Dir.glob(target).select { |file| Md.new(file).valid? }
end