Class: Hybag::BulkIngester

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hybag/bulk_ingester.rb

Instance Method Summary collapse

Constructor Details

#initialize(directory) ⇒ BulkIngester

Returns a new instance of BulkIngester.



3
4
5
# File 'lib/hybag/bulk_ingester.rb', line 3

def initialize(directory)
  @bags = Dir.glob(File.join(directory,"*")).select{|f| File.directory? f}.map{|x| BagIt::Bag.new(x) unless !File.exists?(File.join(x, "bagit.txt"))}.compact
end

Instance Method Details

#eachObject



7
8
9
10
11
12
# File 'lib/hybag/bulk_ingester.rb', line 7

def each
  return enum_for(:each) unless block_given?
  @bags.each do |bag|
    yield Hybag::Ingester.new(bag) if bag.complete?
  end
end