class Ezid::Batch
Attributes
batch_file[R]
format[R]
Public Class Methods
new(format, batch_file)
click to toggle source
# File lib/ezid/batch.rb, line 7 def initialize(format, batch_file) @format = format @batch_file = batch_file end
Public Instance Methods
each(&block)
click to toggle source
# File lib/ezid/batch.rb, line 12 def each(&block) case format when :anvl each_anvl(&block) when :xml each_xml(&block) when :csv each_csv(&block) end end
each_anvl() { |load| ... }
click to toggle source
# File lib/ezid/batch.rb, line 23 def each_anvl(&block) File.open(batch_file, "rb") do |f| while record = f.gets("") head, metadata = record.split(/\n/, 2) id = head.sub(/\A::/, "").strip yield Identifier.load(id, metadata) end end end
each_csv()
click to toggle source
# File lib/ezid/batch.rb, line 37 def each_csv raise NotImplementedError end
each_xml()
click to toggle source
# File lib/ezid/batch.rb, line 33 def each_xml raise NotImplementedError end