Module: FileCrawler::Finder::Command::Resemble

Included in:
FileCrawler::Finder
Defined in:
lib/file_crawler/finder/command/resemble.rb

Instance Method Summary collapse

Instance Method Details

#resembleObject



6
7
8
9
10
# File 'lib/file_crawler/finder/command/resemble.rb', line 6

def resemble()
  tap {
    @rows = resemble_in_collection(@rows.values)
  }
end

#resemble_in_collection(collection) ⇒ Object

use rows after using #collect



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/file_crawler/finder/command/resemble.rb', line 13

def resemble_in_collection(collection)
  files = []

  pattern = /\(\d+\)$/

  collection.each {|files_in_same_directory|
    files_in_same_directory.each {|file|
      filename = File.basename(file)
      files << file unless pattern.match(filename).nil?
    }
  }

  files
end