Module: Pictrails::ImportSystem

Defined in:
lib/pictrails/import_system.rb

Overview

Module to manage the import by mass_upload

Defined Under Namespace

Classes: GalleryImport

Class Method Summary collapse

Class Method Details

.search(path, parent = nil) ⇒ Object

Search all in directory and manage a tree of GalleryImport and PictureImport



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pictrails/import_system.rb', line 23

def self.search(path, parent=nil)
  if File.directory? path
    gallery_import = GalleryImport.new(path, File.basename(path), parent)
    Dir.chdir(path)
    Dir.glob('*') do |file|
      if File.directory?("#{path}/#{file}")
        gallery_import.child << self.search("#{path}/#{file}", gallery_import)
      end
    end
    gallery_import
  end
end