doc/RecordImpl.html in marc4j4r-0.1.3 vs doc/RecordImpl.html in marc4j4r-0.1.4

- old
+ new

@@ -164,11 +164,11 @@ <li class="public "> <span class="summary_signature"> - <a href="#find_by_tag-instance_method" title="#find_by_tag (instance method)">- (Object) <strong>find_by_tag</strong>(tags, originalorder = false) </a> + <a href="#find_by_tag-instance_method" title="#find_by_tag (instance method)">- (Array&lt;Field&gt;) <strong>find_by_tag</strong>(tags, originalorder = false) </a> </span> @@ -176,11 +176,14 @@ - <span class="summary_desc"></span> + <span class="summary_desc"> +Get a (possibly empty) list of fields with the given tag(s). + +</span> </li> <li class="public "> @@ -231,10 +234,54 @@ <li class="public "> <span class="summary_signature"> + <a href="#to_marc-instance_method" title="#to_marc (instance method)">- (Object) <strong>to_marc</strong> </a> + + + + </span> + + + + + + + + <span class="summary_desc"></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#to_marchash-instance_method" title="#to_marchash (instance method)">- (Object) <strong>to_marchash</strong> </a> + + + + </span> + + + + + + + + <span class="summary_desc"> +Export as a MARC-Hash, as described at +http://robotlibrarian.billdueber.com/marc-hash-the-saga-continues-now-with-even-less-structure/. + +</span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + <a href="#to_s-instance_method" title="#to_s (instance method)">- (Object) <strong>to_s</strong> </a> </span> @@ -347,24 +394,32 @@ <tr> <td> <pre class="lines"> -163 -164 -165 -166 -167 -168 -169</pre> +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 163</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 263</span> <span class='def def kw'>def</span> <span class='aref op'>[]</span> <span class='tag identifier id'>tag</span> <span class='if if kw'>if</span> <span class='defined? defined kw'>defined?</span> <span class='@hashedtags ivar id'>@hashedtags</span> - <span class='return return kw'>return</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='tag identifier id'>tag</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span> + <span class='if if kw'>if</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='tag identifier id'>tag</span><span class='rbrack token'>]</span> + <span class='return return kw'>return</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='tag identifier id'>tag</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span> + <span class='else else kw'>else</span> + <span class='return return kw'>return</span> <span class='nil nil kw'>nil</span> + <span class='end end kw'>end</span> <span class='else else kw'>else</span> <span class='return return kw'>return</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getVariableField identifier id'>getVariableField</span><span class='lparen token'>(</span><span class='tag identifier id'>tag</span><span class='rparen token'>)</span> <span class='end end kw'>end</span> <span class='end end kw'>end</span> </pre> @@ -395,18 +450,18 @@ <tr> <td> <pre class="lines"> -152 -153 -154 -155 -156</pre> +252 +253 +254 +255 +256</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 152</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 252</span> <span class='def def kw'>def</span> <span class='each identifier id'>each</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getVariableFields identifier id'>getVariableFields</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='yield yield kw'>yield</span> <span class='f identifier id'>f</span> <span class='end end kw'>end</span> @@ -418,47 +473,171 @@ </div> <div class="method_details "> <p class="signature " id="find_by_tag-instance_method"> - - (<tt>Object</tt>) <strong>find_by_tag</strong>(tags, originalorder = false) + - (<tt>Array&lt;Field&gt;</tt>) <strong>find_by_tag</strong>(tags, originalorder = false) -</p><table class="source_code"> +</p><div class="docstring"> + <div class="discussion"> + <p> +Get a (possibly empty) list of fields with the given tag(s) +</p> + + + </div> +</div> +<div class="tags"> + + <div class="examples"> + <h3>Examples:</h3> + + <h4> +originalorder == false + +</h4> + <pre class="example code"> <span class='comment val'># Given a record that looks like </span> + <span class='comment val'># 010 $a 68027371 </span> + <span class='comment val'># 035 $a (RLIN)MIUG0001728-B </span> + <span class='comment val'># 035 $a (CaOTULAS)159818044 </span> + <span class='comment val'># 035 $a (OCoLC)ocm00001728</span> + + <span class='r identifier id'>r</span><span class='dot token'>.</span><span class='find_by_tag identifier id'>find_by_tag</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='string val'>'035'</span><span class='comma token'>,</span> <span class='string val'>'010'</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='puts identifier id'>puts</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrace token'>}</span> + <span class='comment val'># 035 $a (RLIN)MIUG0001728-B </span> + <span class='comment val'># 035 $a (CaOTULAS)159818044 </span> + <span class='comment val'># 035 $a (OCoLC)ocm00001728</span> + <span class='comment val'># 010 $a 68027371 </span> + +<span class='comment val'># The results are ordered first by tag as passed in, then by original order within the tag</span> +</pre> + + <h4> +Just get all fields for a single tag + +</h4> + <pre class="example code"> <span class='ohThirtyFives identifier id'>ohThirtyFives</span> <span class='assign token'>=</span> <span class='r identifier id'>r</span><span class='dot token'>.</span><span class='find_by_tag identifier id'>find_by_tag</span><span class='lparen token'>(</span><span class='string val'>'035'</span><span class='rparen token'>)</span> +</pre> + + <h4> +Get a bunch of standard identifiers + +</h4> + <pre class="example code"> <span class='standardIDs identifier id'>standardIDs</span> <span class='assign token'>=</span> <span class='r identifier id'>r</span><span class='dot token'>.</span><span class='find_by_tag identifier id'>find_by_tag</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='string val'>'022'</span><span class='comma token'>,</span> <span class='string val'>'020'</span><span class='comma token'>,</span> <span class='string val'>'010'</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> +</pre> + + <h4> +originalorder == true + +</h4> + <pre class="example code"> <span class='r identifier id'>r</span><span class='dot token'>.</span><span class='find_by_tag identifier id'>find_by_tag</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='string val'>'035'</span><span class='comma token'>,</span> <span class='string val'>'010'</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='true true kw'>true</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='puts identifier id'>puts</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrace token'>}</span> + <span class='comment val'># 010 $a 68027371 </span> + <span class='comment val'># 035 $a (RLIN)MIUG0001728-B </span> + <span class='comment val'># 035 $a (CaOTULAS)159818044 </span> + <span class='comment val'># 035 $a (OCoLC)ocm00001728</span> +</pre> + + </div> +<h3>Parameters:</h3> +<ul class="param"> + + <li> + + <span class='type'>(<tt>String</tt>, <tt>Array&lt;String&gt;</tt>)</span> + + + <span class='name'>tags</span> + + + + &mdash; + +A string (or Array of strings) with the tags you&#8217;re interested in + + + + </li> + + <li> + + <span class='type'>(<tt>Boolean</tt>)</span> + + + <span class='name'>originalorder</span> + + + <em class="default">(defaults to: <tt>false</tt>)</em> + + + &mdash; + +Whether or not results should be presented in the original order within the +record or with a two-column sort of (a) Order of the tag in the list of +tags sent, (b) order within that tag in the record + + + + </li> + +</ul> +<h3>Returns:</h3> +<ul class="return"> + + <li> + + <span class='type'>(<tt>Array&lt;Field&gt;</tt>)</span> + + + + + &mdash; + +Either an empty list or a list of one or more matched fields will be +returned. + + +originalorder == false will use an internal hash and be faster in many +cases (see #hashify) + + + + </li> + +</ul> + +</div><table class="source_code"> <tr> <td> <pre class="lines"> -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217</pre> +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 205</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 314</span> <span class='def def kw'>def</span> <span class='find_by_tag identifier id'>find_by_tag</span><span class='lparen token'>(</span><span class='tags identifier id'>tags</span><span class='comma token'>,</span> <span class='originalorder identifier id'>originalorder</span> <span class='assign token'>=</span> <span class='false false kw'>false</span><span class='rparen token'>)</span> + <span class='self self kw'>self</span><span class='dot token'>.</span><span class='hashify identifier id'>hashify</span> <span class='unless unless_mod kw'>unless</span> <span class='@hashedtags ivar id'>@hashedtags</span> <span class='and and kw'>and</span> <span class='notop op'>!</span><span class='originalorder identifier id'>originalorder</span> <span class='if if kw'>if</span> <span class='notop op'>!</span><span class='tags identifier id'>tags</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Array constant id'>Array</span> - <span class='tags identifier id'>tags</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='tags identifier id'>tags</span><span class='rbrack token'>]</span> + <span class='return return kw'>return</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='tags identifier id'>tags</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span> <span class='end end kw'>end</span> - <span class='if if kw'>if</span> <span class='lparen token'>(</span><span class='originalorder identifier id'>originalorder</span> <span class='eq op'>==</span> <span class='false false kw'>false</span> <span class='and and kw'>and</span> <span class='@hashedtags ivar id'>@hashedtags</span> <span class='eq op'>==</span> <span class='nil nil kw'>nil</span><span class='rparen token'>)</span> - <span class='self self kw'>self</span><span class='dot token'>.</span><span class='hashify identifier id'>hashify</span> - <span class='end end kw'>end</span> <span class='if if kw'>if</span> <span class='originalorder identifier id'>originalorder</span> <span class='return return kw'>return</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='find_all identifier id'>find_all</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='tags identifier id'>tags</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span><span class='rbrace token'>}</span> <span class='else else kw'>else</span> + <span class='comment val'># puts &quot;Tags is #{tags}: got #{@hashedtags.values_at(*tags)}&quot;</span> <span class='return return kw'>return</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='dot token'>.</span><span class='values_at identifier id'>values_at</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='tags identifier id'>tags</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span> <span class='end end kw'>end</span> <span class='end end kw'>end</span> </pre> </td> @@ -489,22 +668,24 @@ <tr> <td> <pre class="lines"> -129 -130 -131 -132 -133 -134 -135</pre> +227 +228 +229 +230 +231 +232 +233 +234</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 129</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 227</span> <span class='def def kw'>def</span> <span class='hashify identifier id'>hashify</span> + <span class='return return kw'>return</span> <span class='if if_mod kw'>if</span> <span class='@hashedtags ivar id'>@hashedtags</span> <span class='comment val'># don't do it more than once</span> <span class='@hashedtags ivar id'>@hashedtags</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getVariableFields identifier id'>getVariableFields</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='f identifier id'>f</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span> <span class='@hashedtags ivar id'>@hashedtags</span><span class='lbrack token'>[</span><span class='f identifier id'>f</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='f identifier id'>f</span> <span class='end end kw'>end</span> @@ -537,16 +718,16 @@ <tr> <td> <pre class="lines"> -147 -148 -149</pre> +246 +247 +248</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 147</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 246</span> <span class='def def kw'>def</span> <span class='leader identifier id'>leader</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='get_leader identifier id'>get_leader</span><span class='dot token'>.</span><span class='toString identifier id'>toString</span> <span class='end end kw'>end</span> </pre> @@ -554,10 +735,162 @@ </tr> </table> </div> <div class="method_details "> + <p class="signature " id="to_marc-instance_method"> + + - (<tt>Object</tt>) <strong>to_marc</strong> + + + +</p><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 345</span> + +<span class='def def kw'>def</span> <span class='to_marc identifier id'>to_marc</span> + <span class='begin begin kw'>begin</span> + <span class='s identifier id'>s</span> <span class='assign token'>=</span> <span class='Java constant id'>Java</span><span class='colon2 op'>::</span><span class='java identifier id'>java</span><span class='dot token'>.</span><span class='io identifier id'>io</span><span class='dot token'>.</span><span class='ByteArrayOutputStream constant id'>ByteArrayOutputStream</span><span class='dot token'>.</span><span class='new identifier id'>new</span> + <span class='writer identifier id'>writer</span> <span class='assign token'>=</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='MarcStreamWriter constant id'>MarcStreamWriter</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='s identifier id'>s</span><span class='rparen token'>)</span> + <span class='writer identifier id'>writer</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span> + <span class='@marcbinary ivar id'>@marcbinary</span> <span class='assign token'>=</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='to_string identifier id'>to_string</span> + <span class='puts identifier id'>puts</span> <span class='@marcbinary ivar id'>@marcbinary</span> + <span class='return return kw'>return</span> <span class='@marcbinary ivar id'>@marcbinary</span> + <span class='rescue rescue kw'>rescue</span> + <span class='comment val'># &quot;Woops! to_marc failed for record #{self['001'].data}: #{$!}&quot;</span> + <span class='dstring node'>&quot;Whoops! Failed: #{$!}&quot;</span> + <span class='end end kw'>end</span> +<span class='end end kw'>end</span> +</pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <p class="signature " id="to_marchash-instance_method"> + + - (<tt>Object</tt>) <strong>to_marchash</strong> + + + +</p><div class="docstring"> + <div class="discussion"> + <p> +Export as a MARC-Hash, as described at +http://robotlibrarian.billdueber.com/marc-hash-the-saga-continues-now-with-even-less-structure/ +</p> + + + </div> +</div> +<div class="tags"> + <h3>Returns:</h3> +<ul class="return"> + + <li> + + <span class='type'></span> + + + + + + +A marc-hash representation of the record, suitable for calling .to_json on +or whatever + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 199</span> + +<span class='def def kw'>def</span> <span class='to_marchash identifier id'>to_marchash</span> + <span class='h identifier id'>h</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span> + <span class='h identifier id'>h</span><span class='lbrack token'>[</span><span class='string val'>'type'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>'marc-hash'</span> + <span class='h identifier id'>h</span><span class='lbrack token'>[</span><span class='string val'>'version'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='integer val'>1</span><span class='comma token'>,</span><span class='integer val'>0</span><span class='rbrack token'>]</span> + <span class='h identifier id'>h</span><span class='lbrack token'>[</span><span class='string val'>'leader'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='leader identifier id'>leader</span> + + <span class='fields identifier id'>fields</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span> + + <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getVariableFields identifier id'>getVariableFields</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> + <span class='if if kw'>if</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='controlField? fid id'>controlField?</span> + <span class='fields identifier id'>fields</span> <span class='lshft op'>&lt;&lt;</span> <span class='lbrack token'>[</span><span class='f identifier id'>f</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span><span class='comma token'>,</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='rbrack token'>]</span> + <span class='else else kw'>else</span> + <span class='farray identifier id'>farray</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='f identifier id'>f</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span><span class='comma token'>,</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='indicator1 identifier id'>indicator1</span> <span class='orop op'>||</span> <span class='string val'>' '</span><span class='comma token'>,</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='indicator2 identifier id'>indicator2</span> <span class='orop op'>||</span> <span class='string val'>' '</span><span class='rbrack token'>]</span> + <span class='subs identifier id'>subs</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span> + <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='subfield identifier id'>subfield</span><span class='bitor op'>|</span> + <span class='subs identifier id'>subs</span> <span class='lshft op'>&lt;&lt;</span> <span class='lbrack token'>[</span><span class='subfield identifier id'>subfield</span><span class='dot token'>.</span><span class='code identifier id'>code</span><span class='comma token'>,</span> <span class='subfield identifier id'>subfield</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='rbrack token'>]</span> + <span class='end end kw'>end</span> + <span class='farray identifier id'>farray</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='subs identifier id'>subs</span> + <span class='fields identifier id'>fields</span> <span class='lshft op'>&lt;&lt;</span> <span class='farray identifier id'>farray</span> + <span class='end end kw'>end</span> + <span class='end end kw'>end</span> + <span class='h identifier id'>h</span><span class='lbrack token'>[</span><span class='string val'>'fields'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='fields identifier id'>fields</span> + <span class='return return kw'>return</span> <span class='h identifier id'>h</span> +<span class='end end kw'>end</span> +</pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> <p class="signature " id="to_s-instance_method"> - (<tt>Object</tt>) <strong>to_s</strong> @@ -577,20 +910,20 @@ <tr> <td> <pre class="lines"> -138 -139 -140 -141 -142 -143 -144</pre> +237 +238 +239 +240 +241 +242 +243</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 138</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 237</span> <span class='def def kw'>def</span> <span class='to_s identifier id'>to_s</span> <span class='arr identifier id'>arr</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='string val'>'LEADER '</span> <span class='plus op'>+</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='leader identifier id'>leader</span><span class='rbrack token'>]</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span> <span class='arr identifier id'>arr</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> @@ -644,29 +977,39 @@ <tr> <td> <pre class="lines"> -222 -223 -224 -225 -226 -227 -228 -229</pre> +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 222</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 331</span> <span class='def def kw'>def</span> <span class='to_xml identifier id'>to_xml</span> <span class='return return kw'>return</span> <span class='@xml ivar id'>@xml</span> <span class='if if_mod kw'>if</span> <span class='@xml ivar id'>@xml</span> - <span class='@xml ivar id'>@xml</span> <span class='assign token'>=</span> <span class='java identifier id'>java</span><span class='dot token'>.</span><span class='io identifier id'>io</span><span class='dot token'>.</span><span class='StringWriter constant id'>StringWriter</span><span class='dot token'>.</span><span class='new identifier id'>new</span> - <span class='res identifier id'>res</span> <span class='assign token'>=</span> <span class='javax identifier id'>javax</span><span class='dot token'>.</span><span class='xml identifier id'>xml</span><span class='dot token'>.</span><span class='transform identifier id'>transform</span><span class='dot token'>.</span><span class='stream identifier id'>stream</span><span class='dot token'>.</span><span class='StreamResult constant id'>StreamResult</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='@xml ivar id'>@xml</span><span class='rparen token'>)</span> - <span class='writer identifier id'>writer</span> <span class='assign token'>=</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='MarcXmlWriter constant id'>MarcXmlWriter</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='res identifier id'>res</span><span class='rparen token'>)</span> - <span class='writer identifier id'>writer</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span> - <span class='return return kw'>return</span> <span class='@xml ivar id'>@xml</span><span class='dot token'>.</span><span class='toString identifier id'>toString</span> + <span class='begin begin kw'>begin</span> + <span class='@xml ivar id'>@xml</span> <span class='assign token'>=</span> <span class='java identifier id'>java</span><span class='dot token'>.</span><span class='io identifier id'>io</span><span class='dot token'>.</span><span class='StringWriter constant id'>StringWriter</span><span class='dot token'>.</span><span class='new identifier id'>new</span> + <span class='res identifier id'>res</span> <span class='assign token'>=</span> <span class='javax identifier id'>javax</span><span class='dot token'>.</span><span class='xml identifier id'>xml</span><span class='dot token'>.</span><span class='transform identifier id'>transform</span><span class='dot token'>.</span><span class='stream identifier id'>stream</span><span class='dot token'>.</span><span class='StreamResult constant id'>StreamResult</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='@xml ivar id'>@xml</span><span class='rparen token'>)</span> + <span class='writer identifier id'>writer</span> <span class='assign token'>=</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='MarcXmlWriter constant id'>MarcXmlWriter</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='res identifier id'>res</span><span class='rparen token'>)</span> + <span class='writer identifier id'>writer</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='rparen token'>)</span> + <span class='writer identifier id'>writer</span><span class='dot token'>.</span><span class='writeEndDocument identifier id'>writeEndDocument</span> + <span class='return return kw'>return</span> <span class='@xml ivar id'>@xml</span><span class='dot token'>.</span><span class='toString identifier id'>toString</span> + <span class='rescue rescue kw'>rescue</span> + <span class='dstring node'>&quot;Woops! to_xml failed for record #{self['001'].data}: #{$!}&quot;</span> + <span class='end end kw'>end</span> <span class='end end kw'>end</span> </pre> </td> </tr> </table> @@ -675,10 +1018,10 @@ </div> </div> <div id="footer"> - Generated on Fri Feb 12 16:38:06 2010 by + Generated on Sat Apr 3 22:01:06 2010 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a> 0.5.3 (ruby-1.8.7). </div> </body> \ No newline at end of file