Module: MARC4J4R
- Defined in:
- lib/marc4j4r.rb
Defined Under Namespace
Classes: AlephSequentialReader
Constant Summary
- NEWINIT = Add some sugar to the MarcReader interface.
"include Enumerable\nalias_method :oldinit, :initialize\ndef initialize(fromwhere)\nstream = nil\nif fromwhere.is_a? Java::JavaIO::InputStream or fromwhere.is_a? Java::JavaIO::ByteArrayInputStream\nstream = fromwhere\nelsif fromwhere.is_a? IO\nstream = fromwhere.to_inputstream\nelse\nstream = java.io.FileInputStream.new(fromwhere.to_java_string)\nend\nif self.class == Java::org.marc4j.MarcPermissiveStreamReader\nself.oldinit(stream, true, true)\nelse\nself.oldinit(stream)\nend\nend\n"
Instance Method Summary
- - (MarcReader) reader(input, type = :strictmarc) Get a marc reader of the appropriate type.
Instance Method Details
- (MarcReader) reader(input, type = :strictmarc)
Get a marc reader of the appropriate type
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/marc4j4r.rb', line 101 def reader(input, type = :strictmarc) case type when :strictmarc then return Java::org.marc4j.MarcStreamReader.new(input) when :permissivemarc then return Java::org.marc4j.MarcPermissiveStreamReader.new(input) when :marcxml then return Java::org.marc4j.MarcXmlReader.new(input) when :alephsequential then return MARC4J4R::AlephSequentialReader.new(input) else raise ArgumentError, "Reader type #{type} illegal: must be :strictmarc, :permissivemarc, :marcxml, or :alephsequential" end end |