Class: Collector

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging
Defined in:
lib/filentory/collector.rb

Instance Method Summary collapse

Instance Method Details

#collect(path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/filentory/collector.rb', line 9

def collect(path)
  result = Array.new
  @pathname = Pathname.new(path)

  Find.find(path) do |file|
    begin
      if File.directory?(file)
        info "skipping #{file}"
        next
      end
      if File.pipe?(file)
        info "skippking pipe #{file}"
        next
      end
      result << extract_file_infos(file)
    rescue => file_error
      error ("error with file '#{path}': #{file}")
    end
  end

  result
end