Sha256: d86553432171aaa346814c955596530d078d3674fb3a52add285e1e6436e1c3f
Contents?: true
Size: 954 Bytes
Versions: 4
Compression:
Stored size: 954 Bytes
Contents
module MARC4J4R # Add some sugar to the MarcWriter interface # # Adjust the interface so that a #new call to any implementations that # implement it can take a java.io.InputStream, ruby IO object, or String # (that will be interpreted as a filename) without complaining. # # The mechanism -- running module_eval on a string-representation of the # new method in each of the hard-coded implementations -- is ugly # and deeply unsettling. # # @author Bill Dueber # class Writer # A simple factory to return the correct type of writer def self.new output, type = :strictmarc @handle = IOConvert.byteoutstream(output) if type == :strictmarc return Java::org.marc4j.MarcStreamWriter.new(@handle) elsif type == :marcxml return Java::org.marc4j.MarcStreamWriter.new(@handle) else raise ArgumentError.new("#{type} must be :strictmarc or :marcxml") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
marc4j4r-1.0.0 | lib/marc4j4r/writer.rb |
marc4j4r-0.9.0 | lib/marc4j4r/writer.rb |
marc4j4r-0.2.4 | lib/marc4j4r/writer.rb |
marc4j4r-0.2.2 | lib/marc4j4r/writer.rb |