rmarc 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ 00714cam a2200205 a 45000010009000000050017000090080041000260200015000670200022000820400018001041000021001222450034001432500012001772600067001893000021002565200175002776500013004526500023004656500020004881288337620030616111422.0020805s2002 nyu j 000 1 eng  a0786808772 a0786816155 (pbk.) aDLCcDLCdDLC1 aChabon, Michael.10aSummerland /cMichael Chabon. a1st ed. aNew York :bMiramax Books/Hyperion Books for Children,cc2002. a500 p. ;c22 cm. aEthan Feld, the worst baseball player in the history of the game, finds himself recruited by a 100-year-old scout to help a band of fairies triumph over an ancient enemy. 1aFantasy. 1aBaseballvFiction. 1aMagicvFiction.
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim">
2
+ <record>
3
+ <leader>00714cam a2200205 a 4500</leader>
4
+ <controlfield tag="001">12883376</controlfield>
5
+ <controlfield tag="005">20030616111422.0</controlfield>
6
+ <controlfield tag="008">020805s2002 nyu j 000 1 eng </controlfield>
7
+ <datafield tag="020" ind1=" " ind2=" ">
8
+ <subfield code="a">0786808772</subfield>
9
+ </datafield>
10
+ <datafield tag="020" ind1=" " ind2=" ">
11
+ <subfield code="a">0786816155 (pbk.)</subfield>
12
+ </datafield>
13
+ <datafield tag="040" ind1=" " ind2=" ">
14
+ <subfield code="a">DLC</subfield>
15
+ <subfield code="c">DLC</subfield>
16
+ <subfield code="d">DLC</subfield>
17
+ </datafield>
18
+ <datafield tag="100" ind1="1" ind2=" ">
19
+ <subfield code="a">Chabon, Michael.</subfield>
20
+ </datafield>
21
+ <datafield tag="245" ind1="1" ind2="0">
22
+ <subfield code="a">Summerland /</subfield>
23
+ <subfield code="c">Michael Chabon.</subfield>
24
+ </datafield>
25
+ <datafield tag="250" ind1=" " ind2=" ">
26
+ <subfield code="a">1st ed.</subfield>
27
+ </datafield>
28
+ <datafield tag="260" ind1=" " ind2=" ">
29
+ <subfield code="a">New York :</subfield>
30
+ <subfield code="b">Miramax Books/Hyperion Books for Children,</subfield>
31
+ <subfield code="c">c2002.</subfield>
32
+ </datafield>
33
+ <datafield tag="300" ind1=" " ind2=" ">
34
+ <subfield code="a">500 p. ;</subfield>
35
+ <subfield code="c">22 cm.</subfield>
36
+ </datafield>
37
+ <datafield tag="520" ind1=" " ind2=" ">
38
+ <subfield code="a">Ethan Feld, the worst baseball player in the history of the game, finds himself recruited by a 100-year-old scout to help a band of fairies triumph over an ancient enemy.</subfield>
39
+ </datafield>
40
+ <datafield tag="650" ind1=" " ind2="1">
41
+ <subfield code="a">Fantasy.</subfield>
42
+ </datafield>
43
+ <datafield tag="650" ind1=" " ind2="1">
44
+ <subfield code="a">Baseball</subfield>
45
+ <subfield code="v">Fiction.</subfield>
46
+ </datafield>
47
+ <datafield tag="650" ind1=" " ind2="1">
48
+ <subfield code="a">Magic</subfield>
49
+ <subfield code="v">Fiction.</subfield>
50
+ </datafield>
51
+ </record>
52
+ </collection>
@@ -0,0 +1,78 @@
1
+ # $Id: test_model.rb,v 1.1 2005/12/07 19:56:56 bpeters Exp $
2
+ #
3
+ # Copyright (c) 2005 Bas Peters
4
+ #
5
+ # This file is part of RMARC
6
+ #
7
+ # RMARC is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # RMARC is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with RMARC; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ $: << File.dirname(__FILE__) + "/.." << File.dirname(__FILE__) + "/../lib"
22
+
23
+ require 'test/unit'
24
+ require 'rmarc'
25
+
26
+ class TestModel < Test::Unit::TestCase
27
+
28
+ def test_control_field
29
+ field = RMARC::ControlField.new("001", "12883376")
30
+ assert_equal("001", field.tag)
31
+ assert_equal("12883376", field.data)
32
+ end
33
+
34
+ def test_subfield
35
+ subfield = RMARC::Subfield.new("a", "Summerland")
36
+ assert_equal("a", subfield.code)
37
+ assert_equal("Summerland", subfield.data)
38
+ end
39
+
40
+ def test_data_field
41
+ field = RMARC::DataField.new("245", "1", "0")
42
+ assert_equal("245", field.tag)
43
+ assert_equal("1", field.ind1)
44
+ assert_equal("0", field.ind2)
45
+ assert_equal(0, field.subfields.length)
46
+ subfield = RMARC::Subfield.new("a", "Summerland")
47
+ field.add(subfield)
48
+ assert_equal(1, field.subfields.length)
49
+ subfield = RMARC::Subfield.new("c", "Michael Chabon")
50
+ field.add(subfield)
51
+ assert_equal(2, field.subfields.length)
52
+ field.remove(subfield)
53
+ assert_equal(1, field.subfields.length)
54
+ assert_equal("a", field.subfields.last.code)
55
+ end
56
+
57
+ def test_leader
58
+ leader = RMARC::Leader.new("00714cam a2200205 a 4500")
59
+ assert_equal(714, leader.record_length)
60
+ assert_equal("a", leader.char_coding)
61
+ assert_equal(205, leader.base_address)
62
+ assert_equal("00714cam a2200205 a 4500", leader.to_s)
63
+ end
64
+
65
+ def test_record
66
+ record = RMARC::Record.new()
67
+ assert_equal(0, record.fields.length)
68
+ field = RMARC::ControlField.new("001", "12883376")
69
+ record.add(field)
70
+ assert_equal(1, record.fields.length)
71
+ field = RMARC::DataField.new("245", "1", "0")
72
+ record.add(field)
73
+ assert_equal(2, record.fields.length)
74
+ record.remove(field)
75
+ assert_equal("001", record.fields.last.tag)
76
+ end
77
+
78
+ end
@@ -0,0 +1,50 @@
1
+ # $Id: test_reader.rb,v 1.1 2005/12/07 19:56:56 bpeters Exp $
2
+ #
3
+ # Copyright (c) 2005 Bas Peters
4
+ #
5
+ # This file is part of RMARC
6
+ #
7
+ # RMARC is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # RMARC is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with RMARC; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ $: << File.dirname(__FILE__) + "/.." << File.dirname(__FILE__) + "/../lib"
22
+
23
+ require 'test/unit'
24
+ require 'rmarc'
25
+
26
+ class TestMarcReader < Test::Unit::TestCase
27
+
28
+ def test_parse_marc
29
+ assert_nothing_raised() {
30
+ File.open("test/chabon.mrc", "r") do |file|
31
+ reader = RMARC::MarcStreamReader.new(file)
32
+ while reader.has_next
33
+ record = reader.next()
34
+ end
35
+ end
36
+ }
37
+ end
38
+
39
+ def test_parse_marc_xml
40
+ assert_nothing_raised() {
41
+ File.open("test/chabon.xml", "r") do |file|
42
+ reader = RMARC::MarcXmlReader.new(file)
43
+ while reader.has_next
44
+ record = reader.next()
45
+ end
46
+ end
47
+ }
48
+ end
49
+
50
+ end
@@ -0,0 +1,56 @@
1
+ # $Id: test_writer.rb,v 1.1 2005/12/07 19:56:56 bpeters Exp $
2
+ #
3
+ # Copyright (c) 2005 Bas Peters
4
+ #
5
+ # This file is part of RMARC
6
+ #
7
+ # RMARC is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # RMARC is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with RMARC; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ $: << File.dirname(__FILE__) + "/.." << File.dirname(__FILE__) + "/../lib"
22
+
23
+ require 'test/unit'
24
+ require 'rmarc'
25
+
26
+ class TestMarcWriter < Test::Unit::TestCase
27
+
28
+ def test_write_marc
29
+ assert_nothing_raised() {
30
+ File.open("test/chabon.mrc", "r") do |file|
31
+ reader = RMARC::MarcStreamReader.new(file)
32
+ writer = RMARC::MarcStreamWriter.new(STDOUT)
33
+ while reader.has_next
34
+ record = reader.next()
35
+ writer.write_record(record)
36
+ end
37
+ end
38
+ }
39
+ end
40
+
41
+ def test_write_marc_xml
42
+ assert_nothing_raised() {
43
+ writer = RMARC::MarcXmlWriter.new(STDOUT)
44
+ File.open("test/chabon.mrc", "r") do |file|
45
+ reader = RMARC::MarcStreamReader.new(file)
46
+ writer.start_document
47
+ while reader.has_next
48
+ record = reader.next()
49
+ writer.write_record(record)
50
+ end
51
+ writer.end_document
52
+ end
53
+ }
54
+ end
55
+
56
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: rmarc
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.1
7
+ date: 2005-12-07
8
+ summary: RMARC is a library for working with MARC and MARC XML data in Ruby
9
+ require_paths:
10
+ - lib
11
+ email: bpeters@rubyforge.org
12
+ homepage: http://rmarc.rubyforge.org
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ authors:
28
+ - Bas Peters
29
+ files:
30
+ - lib/rmarc
31
+ - lib/rmarc.rb
32
+ - lib/rmarc/constants.rb
33
+ - lib/rmarc/marc_stream_reader.rb
34
+ - lib/rmarc/marc_stream_writer.rb
35
+ - lib/rmarc/marc_xml_reader.rb
36
+ - lib/rmarc/marc_xml_writer.rb
37
+ - lib/rmarc/model
38
+ - lib/rmarc/model/control_field.rb
39
+ - lib/rmarc/model/data_field.rb
40
+ - lib/rmarc/model/directory.rb
41
+ - lib/rmarc/model/leader.rb
42
+ - lib/rmarc/model/record.rb
43
+ - lib/rmarc/model/subfield.rb
44
+ - lib/rmarc/model/variable_field.rb
45
+ - test/chabon.mrc
46
+ - test/chabon.xml
47
+ - test/summerland.mrc
48
+ - test/summerland.xml
49
+ - test/test_model.rb
50
+ - test/test_reader.rb
51
+ - test/test_writer.rb
52
+ - LICENSE
53
+ test_files: []
54
+ rdoc_options: []
55
+ extra_rdoc_files:
56
+ - LICENSE
57
+ executables: []
58
+ extensions: []
59
+ requirements: []
60
+ dependencies: []