Module: MARC4J4R
- Defined in:
- lib/marc4j4r.rb
Constant Summary
- NEWINIT = A string used to override the initializer for each stream reader Need to do it this ugly way because of the way java and ruby interact; can’t just add it to the MarcReader interface the way I wanted to.
"alias_method :oldinit, :initialize\ndef initialize(fromwhere)\nstream = nil\nif fromwhere.is_a? Java::JavaIO::InputStream\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
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/marc4j4r.rb', line 76 def reader(input, type = :strictmarc) case type when :strictmarc return Java::org.marc4j.MarcStreamReader.new(input) when :permissivemarc return Java::org.marc4j.MarcPermissiveStreamReader.new(input) when :marcxml return Java::org.marc4j.MarcXmlReader.new(input) else raise ArgumentError, "Reader type must be :strictmarc, :permissivemarc, or :marcxml" end end |