Class: Biblioteque::Crawler
- Inherits:
-
Object
- Object
- Biblioteque::Crawler
- Defined in:
- lib/biblioteque/crawler.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ Crawler
constructor
A new instance of Crawler.
- #search_for_library(library_id) ⇒ Object
Constructor Details
#initialize(path) ⇒ Crawler
Returns a new instance of Crawler.
4 5 6 7 |
# File 'lib/biblioteque/crawler.rb', line 4 def initialize(path) raise "No" unless path @path = path end |
Instance Method Details
#search_for_library(library_id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/biblioteque/crawler.rb', line 9 def search_for_library(library_id) arr = [] Find.find(@path) do |path| if FileTest.directory?(path) if File.basename(path)[0] == ?. and File.basename(path) != '.' Find.prune else arr << make_file_obj(path, library_id) if path != @path # add directory end else arr << make_file_obj(path, library_id) # add file end end return arr end |