Sha256: 4295b945141bc4a7ea66957ebbbb80343e1be269ab0e45b12304f522e7082d42

Contents?: true

Size: 891 Bytes

Versions: 1

Compression:

Stored size: 891 Bytes

Contents

# nodoc #
module Pictrails

  # Module to manage the import by mass_upload
  module ImportSystem
    
    # Manage a GalleryImport for the mass_upload
    class GalleryImport
      attr_reader :name, :path, :parent
      attr_accessor :child

      def initialize(path, name, parent)
        @path = path
        @name = name
        @parent = parent
        @child = []
      end

    end

    # Search all in directory and manage a tree of GalleryImport
    # and PictureImport
    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
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pictrails-0.5.0 lib/pictrails/import_system.rb