Module: FileCrawler
- Defined in:
- lib/file_crawler/finder.rb,
lib/file_crawler/version.rb,
lib/file_crawler/finder/command/move.rb,
lib/file_crawler/finder/command/search.rb,
lib/file_crawler/finder/command/collect.rb,
lib/file_crawler/finder/command/resemble.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.4.1"
Class Method Summary collapse
-
.collect(path, conditions = {}) ⇒ Object
conditions - if dont have extension_in_directory, directory true.
-
.move(path, destination, conditions = {}) ⇒ Object
conditions - if dont have extension_in_directory, directory true - move check? if include, need condition.
- .organize(path, destination, conditions = {}) ⇒ Object
- .resemble(path, conditions = {}) ⇒ Object
- .search(path, conditions = {}) ⇒ Object
Class Method Details
.collect(path, conditions = {}) ⇒ Object
conditions
-
if dont have extension_in_directory, directory true
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/file_crawler/finder.rb', line 43 def self.collect(path, conditions = {}) finder = FileCrawler::Finder.new unless conditions[:regexs].nil? conditions[:regexs].each {|regex| finder.regexs << regex } end finder.search(path).collect(conditions) finder.rows end |
.move(path, destination, conditions = {}) ⇒ Object
conditions
-
if dont have extension_in_directory, directory true
-
move check? if include, need condition
32 33 34 35 36 37 38 39 |
# File 'lib/file_crawler/finder.rb', line 32 def self.move(path, destination, conditions = {}) raise ArgumentError unless File.directory?(destination) finder = FileCrawler::Finder.new finder.search(path).move(destination) finder.rows end |
.organize(path, destination, conditions = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/file_crawler/finder.rb', line 56 def self.organize(path, destination, conditions = {}) finder = FileCrawler::Finder.new unless conditions[:regexs].nil? conditions[:regexs].each {|regex| finder.regexs << regex } end finder.search(path).collect(conditions).move_from_collection(destination) finder.rows end |
.resemble(path, conditions = {}) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/file_crawler/finder.rb', line 70 def self.resemble(path, conditions = {}) finder = FileCrawler::Finder.new finder.search(path).collect(conditions).resemble() finder.rows end |
.search(path, conditions = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/file_crawler/finder.rb', line 22 def self.search(path, conditions = {}) finder = FileCrawler::Finder.new finder.search(path, conditions) finder.rows end |