marc4j4r 0.1.6 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/README.rdoc +17 -0
  2. data/Rakefile +26 -13
  3. data/VERSION +1 -1
  4. data/jars/marc4j.jar +0 -0
  5. data/lib/marc4j4r/controlfield.rb +32 -0
  6. data/lib/marc4j4r/datafield.rb +196 -0
  7. data/lib/marc4j4r/reader.rb +71 -0
  8. data/lib/marc4j4r/record.rb +214 -0
  9. data/lib/marc4j4r/writer.rb +29 -0
  10. data/lib/marc4j4r.rb +26 -485
  11. data/lib/original_monolithic_file.rb +518 -0
  12. data/spec/batch.dat +1 -0
  13. data/spec/batch.txt +193 -0
  14. data/spec/batch.xml +13 -0
  15. data/spec/controlfield_spec.rb +40 -0
  16. data/spec/datafield_spec.rb +56 -0
  17. data/spec/one.dat +1 -0
  18. data/spec/one.txt +17 -0
  19. data/spec/one.xml +4 -0
  20. data/spec/reader_spec.rb +49 -0
  21. data/spec/record_spec.rb +101 -0
  22. data/{test/helper.rb → spec/spec_helper.rb} +9 -5
  23. metadata +74 -80
  24. data/.document +0 -5
  25. data/.gitignore +0 -21
  26. data/README.markdown +0 -41
  27. data/doc/ControlFieldImpl.html +0 -314
  28. data/doc/DataFieldImpl.html +0 -875
  29. data/doc/Java/OrgMarc4j/MarcReader.html +0 -184
  30. data/doc/MARC4J4R/Reader.html +0 -245
  31. data/doc/MARC4J4R.html +0 -281
  32. data/doc/RecordImpl.html +0 -686
  33. data/doc/SubfieldImpl.html +0 -252
  34. data/doc/_index.html +0 -153
  35. data/doc/class_list.html +0 -36
  36. data/doc/css/common.css +0 -1
  37. data/doc/css/full_list.css +0 -50
  38. data/doc/css/style.css +0 -268
  39. data/doc/file.README.html +0 -90
  40. data/doc/file_list.html +0 -38
  41. data/doc/frames.html +0 -13
  42. data/doc/index.html +0 -90
  43. data/doc/js/app.js +0 -99
  44. data/doc/js/full_list.js +0 -106
  45. data/doc/js/jquery.js +0 -19
  46. data/doc/method_list.html +0 -219
  47. data/doc/top-level-namespace.html +0 -87
  48. data/jars/MarcImporter.jar +0 -0
  49. data/test/batch.seq +0 -118
  50. data/test/bench.rb +0 -63
  51. data/test/one.dat +0 -1
  52. data/test/one.seq +0 -30
  53. data/test/one.xml +0 -55
  54. data/test/test_marc4j4r.rb +0 -76
data/doc/MARC4J4R.html DELETED
@@ -1,281 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta name="Content-Type" content="text/html; charset=UTF-8" />
6
- <title>Module: MARC4J4R</title>
7
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
-
10
- <script type="text/javascript" charset="utf-8">
11
- relpath = '';
12
- if (relpath != '') relpath += '/';
13
- </script>
14
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
-
17
- </head>
18
- <body>
19
- <script type="text/javascript" charset="utf-8">
20
- if (window.top.frames.main) document.body.className = 'frames';
21
- </script>
22
-
23
- <div id="header">
24
- <div id="menu">
25
-
26
- <a href="_index.html">Index (M)</a> &raquo;
27
-
28
-
29
- <span class="title">MARC4J4R</span>
30
-
31
-
32
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
- </div>
34
-
35
- <div id="search">
36
- <a id="class_list_link" href="#">Class List</a>
37
- <a id="method_list_link" href="#">Method List</a>
38
- <a id ="file_list_link" href="#">File List</a>
39
- </div>
40
-
41
- <div class="clear"></div>
42
- </div>
43
-
44
- <iframe id="search_frame"></iframe>
45
-
46
- <div id="content"><h1>Module: MARC4J4R
47
-
48
-
49
- </h1>
50
-
51
- <dl class="box">
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
- <dt class="r1 last">Defined in:</dt>
60
- <dd class="r1 last">lib/marc4j4r.rb</dd>
61
-
62
- </dl>
63
- <div class="clear"></div>
64
-
65
-
66
- <h2>Constant Summary</h2>
67
-
68
- <dl class="constants">
69
-
70
- <dt id="NEWINIT-constant" class="">NEWINIT =
71
- <span class="summary_desc">
72
- A string used to override the initializer for each stream reader Need to do
73
- it this ugly way because of the way java and ruby interact; can&#8217;t
74
- just add it to the MarcReader interface the way I wanted to.
75
-
76
- </span>
77
- </dt>
78
- <dd><pre class="code"><span class='string val'>&quot;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&quot;</span>
79
- </pre></dd>
80
-
81
- </dl>
82
-
83
-
84
-
85
-
86
- <h2>Instance Method Summary</h2>
87
-
88
- <ul class="summary">
89
-
90
- <li class="public ">
91
- <span class="summary_signature">
92
-
93
- <a href="#reader-instance_method" title="#reader (instance method)">- (MarcReader) <strong>reader</strong>(input, type = :strictmarc) </a>
94
-
95
-
96
-
97
- </span>
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
- <span class="summary_desc">
106
- Get a marc reader of the appropriate type.
107
-
108
- </span>
109
-
110
- </li>
111
-
112
-
113
- </ul>
114
-
115
-
116
- <div id="instance_method_details" class="method_details_list">
117
- <h2>Instance Method Details</h2>
118
-
119
-
120
- <div class="method_details first">
121
- <p class="signature first" id="reader-instance_method">
122
-
123
- - (<tt>MarcReader</tt>) <strong>reader</strong>(input, type = :strictmarc)
124
-
125
-
126
-
127
- </p><div class="docstring">
128
- <div class="discussion">
129
- <p>
130
- Get a marc reader of the appropriate type
131
- </p>
132
-
133
-
134
- </div>
135
- </div>
136
- <div class="tags">
137
-
138
- <div class="examples">
139
- <h3>Examples:</h3>
140
-
141
- <h4>
142
- Get a strict binary MARC reader for the file &#8216;test.mrc&#8217;
143
-
144
- </h4>
145
- <pre class="example code"> <span class='reader identifier id'>reader</span> <span class='assign token'>=</span> <span class='MARC4J4R constant id'>MARC4J4R</span><span class='dot token'>.</span><span class='reader identifier id'>reader</span><span class='lparen token'>(</span><span class='string val'>'test.mrc'</span><span class='rparen token'>)</span>
146
- </pre>
147
-
148
- <h4>
149
- Get a permissive binary MARC reader
150
-
151
- </h4>
152
- <pre class="example code"> <span class='reader identifier id'>reader</span> <span class='assign token'>=</span> <span class='MARC4J4R constant id'>MARC4J4R</span><span class='dot token'>.</span><span class='reader identifier id'>reader</span><span class='lparen token'>(</span><span class='string val'>'test.mrc'</span><span class='comma token'>,</span> <span class='symbol val'>:permissivemarc</span><span class='rparen token'>)</span>
153
- </pre>
154
-
155
- <h4>
156
- Get a reader for an xml file
157
-
158
- </h4>
159
- <pre class="example code"> <span class='reader identifier id'>reader</span> <span class='assign token'>=</span> <span class='MARC4J4R constant id'>MARC4J4R</span><span class='dot token'>.</span><span class='reader identifier id'>reader</span><span class='lparen token'>(</span><span class='string val'>'test.xml'</span><span class='comma token'>,</span> <span class='symbol val'>:marcxml</span><span class='rparen token'>)</span>
160
- </pre>
161
-
162
- <h4>
163
- Get a reader based on an existing IO object
164
-
165
- </h4>
166
- <pre class="example code"> <span class='require identifier id'>require</span> <span class='string val'>'open-uri'</span>
167
- <span class='infile identifier id'>infile</span> <span class='assign token'>=</span> <span class='open identifier id'>open</span><span class='lparen token'>(</span><span class='string val'>'http://my.machine.com/test.mrc'</span><span class='rparen token'>)</span>
168
- <span class='reader identifier id'>reader</span> <span class='assign token'>=</span> <span class='MARC4J4R constant id'>MARC4J4R</span><span class='dot token'>.</span><span class='reader identifier id'>reader</span><span class='lparen token'>(</span><span class='infile identifier id'>infile</span><span class='rparen token'>)</span>
169
- </pre>
170
-
171
- </div>
172
- <h3>Parameters:</h3>
173
- <ul class="param">
174
-
175
- <li>
176
-
177
- <span class='type'>(<tt>String</tt>, <tt>IO</tt>, <tt>java.io.InputStream</tt>)</span>
178
-
179
-
180
- <span class='name'>input</span>
181
-
182
-
183
-
184
- &mdash;
185
-
186
- The IO stream (or filename) from which you want to read
187
-
188
-
189
-
190
- </li>
191
-
192
- <li>
193
-
194
- <span class='type'>(<tt>:strictmarc</tt>, <tt>:permissivemarc</tt>, <tt>:marcxml</tt>)</span>
195
-
196
-
197
- <span class='name'>The</span>
198
-
199
-
200
-
201
- &mdash;
202
-
203
- type of MARC reader you want.
204
-
205
-
206
-
207
- </li>
208
-
209
- </ul>
210
- <h3>Returns:</h3>
211
- <ul class="return">
212
-
213
- <li>
214
-
215
- <span class='type'>(<tt>MarcReader</tt>)</span>
216
-
217
-
218
-
219
-
220
- &mdash;
221
-
222
- A MarcReader object with the syntactic sugar added in this file (e.g, each)
223
-
224
-
225
-
226
- </li>
227
-
228
- </ul>
229
-
230
- </div><table class="source_code">
231
- <tr>
232
- <td>
233
- <pre class="lines">
234
-
235
-
236
- 76
237
- 77
238
- 78
239
- 79
240
- 80
241
- 81
242
- 82
243
- 83
244
- 84
245
- 85
246
- 86
247
- 87</pre>
248
- </td>
249
- <td>
250
- <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 76</span>
251
-
252
- <span class='def def kw'>def</span> <span class='reader identifier id'>reader</span><span class='lparen token'>(</span><span class='input identifier id'>input</span><span class='comma token'>,</span> <span class='type identifier id'>type</span> <span class='assign token'>=</span> <span class='symbol val'>:strictmarc</span><span class='rparen token'>)</span>
253
- <span class='case case kw'>case</span> <span class='type identifier id'>type</span>
254
- <span class='when when kw'>when</span> <span class='symbol val'>:strictmarc</span>
255
- <span class='return return kw'>return</span> <span class='Java constant id'>Java</span><span class='colon2 op'>::</span><span class='org identifier id'>org</span><span class='dot token'>.</span><span class='marc4j identifier id'>marc4j</span><span class='dot token'>.</span><span class='MarcStreamReader constant id'>MarcStreamReader</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='input identifier id'>input</span><span class='rparen token'>)</span>
256
- <span class='when when kw'>when</span> <span class='symbol val'>:permissivemarc</span>
257
- <span class='return return kw'>return</span> <span class='Java constant id'>Java</span><span class='colon2 op'>::</span><span class='org identifier id'>org</span><span class='dot token'>.</span><span class='marc4j identifier id'>marc4j</span><span class='dot token'>.</span><span class='MarcPermissiveStreamReader constant id'>MarcPermissiveStreamReader</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='input identifier id'>input</span><span class='rparen token'>)</span>
258
- <span class='when when kw'>when</span> <span class='symbol val'>:marcxml</span>
259
- <span class='return return kw'>return</span> <span class='Java constant id'>Java</span><span class='colon2 op'>::</span><span class='org identifier id'>org</span><span class='dot token'>.</span><span class='marc4j identifier id'>marc4j</span><span class='dot token'>.</span><span class='MarcXmlReader constant id'>MarcXmlReader</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='input identifier id'>input</span><span class='rparen token'>)</span>
260
- <span class='else else kw'>else</span>
261
- <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>&quot;Reader type must be :strictmarc, :permissivemarc, or :marcxml&quot;</span>
262
- <span class='end end kw'>end</span>
263
- <span class='end end kw'>end</span>
264
- </pre>
265
- </td>
266
- </tr>
267
- </table>
268
- </div>
269
-
270
- </div>
271
-
272
- </div>
273
-
274
- <div id="footer">
275
- Generated on Fri Feb 12 16:38:06 2010 by
276
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
277
- 0.5.3 (ruby-1.8.7).
278
- </div>
279
-
280
- </body>
281
- </html>