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

- old
+ new

@@ -90,11 +90,11 @@ <ul class="summary"> <li class="public "> <span class="summary_signature"> - <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (String) <strong>[]</strong>(code) </a> + <a href="#%3D%3D-instance_method" title="#== (instance method)">- (Object) <strong>=</strong>(other) </a> </span> @@ -103,21 +103,21 @@ <span class="summary_desc"> -Get the value of the first subfield of this field with the given code. +Broken. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong> </a> + <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (String) <strong>[]</strong>(code) </a> </span> @@ -126,21 +126,21 @@ <span class="summary_desc"> -Iterate over the subfields. +Get the value of the first subfield of this field with the given code. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#indicator1-instance_method" title="#indicator1 (instance method)">- (Object) <strong>indicator1</strong> </a> + <a href="#controlField%3F-instance_method" title="#controlField? (instance method)">- (Boolean) <strong>controlField?</strong> </a> </span> @@ -148,22 +148,42 @@ + <span class="summary_desc"></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong> </a> + + + + </span> + + + + + + + <span class="summary_desc"> -Get first indicator as a one-character string. +Iterate over the subfields. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#indicator2-instance_method" title="#indicator2 (instance method)">- (Object) <strong>indicator2</strong> </a> + <a href="#indicator1-instance_method" title="#indicator1 (instance method)">- (Object) <strong>indicator1</strong> </a> </span> @@ -172,21 +192,21 @@ <span class="summary_desc"> -Get second indicator as a one-character string. +Get first indicator as a one-character string. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#sub_values-instance_method" title="#sub_values (instance method)">- (Array&lt;String&gt;) <strong>sub_values</strong>(code, myorder = false) </a> + <a href="#indicator2-instance_method" title="#indicator2 (instance method)">- (Object) <strong>indicator2</strong> </a> </span> @@ -195,21 +215,21 @@ <span class="summary_desc"> -Get all values from the subfields for the given code or array of codes. +Get second indicator as a one-character string. </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>(joiner = ' ') </a> + <a href="#sub_values-instance_method" title="#sub_values (instance method)">- (Array&lt;String&gt;) <strong>sub_values</strong>(code, myorder = false) </a> </span> @@ -218,21 +238,21 @@ <span class="summary_desc"> -Pretty-print. +Get all values from the subfields for the given code or array of codes. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong>(joiner = ' ') </a> + <a href="#to_s-instance_method" title="#to_s (instance method)">- (Object) <strong>to_s</strong>(joiner = ' ') </a> </span> @@ -241,22 +261,21 @@ <span class="summary_desc"> -Get the concatentated values of the subfields in order the appear in the -field. +Pretty-print. </span> </li> <li class="public "> <span class="summary_signature"> - <a href="#via_tagspec-instance_method" title="#via_tagspec (instance method)">- (Object) <strong>via_tagspec</strong>(tagspec) </a> + <a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong>(joiner = ' ') </a> </span> @@ -264,11 +283,15 @@ - <span class="summary_desc"></span> + <span class="summary_desc"> +Get the concatentated values of the subfields in order the appear in the +field. + +</span> </li> </ul> @@ -278,12 +301,56 @@ <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> - <p class="signature first" id="[]-instance_method"> + <p class="signature first" id="==-instance_method"> + - (<tt>Object</tt>) <strong>==</strong>(other) + + + +</p><div class="docstring"> + <div class="discussion"> + <p> +Broken. Need to check subs as well +</p> + + + </div> +</div> +<div class="tags"> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +395 +396 +397 +398 +399</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 395</span> + +<span class='def def kw'>def</span> <span class='eq op'>==</span> <span class='other identifier id'>other</span> + <span class='self self kw'>self</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span> <span class='eq op'>==</span> <span class='other identifier id'>other</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span> <span class='and and kw'>and</span> + <span class='self self kw'>self</span><span class='dot token'>.</span><span class='indicator1 identifier id'>indicator1</span> <span class='eq op'>==</span> <span class='other identifier id'>other</span><span class='dot token'>.</span><span class='indicator1 identifier id'>indicator1</span> <span class='and and kw'>and</span> + <span class='self self kw'>self</span><span class='dot token'>.</span><span class='indicator2 identifier id'>indicator2</span> <span class='eq op'>==</span> <span class='other identifier id'>other</span><span class='dot token'>.</span><span class='indicator2 identifier id'>indicator2</span> +<span class='end end kw'>end</span> +</pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <p class="signature " id="[]-instance_method"> + - (<tt>String</tt>) <strong>[]</strong>(code) </p><div class="docstring"> @@ -354,33 +421,91 @@ <tr> <td> <pre class="lines"> -296 -297 -298 -299 -300 -301</pre> +415 +416 +417 +418 +419 +420 +421 +422 +423 +424</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 296</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 415</span> <span class='def def kw'>def</span> <span class='aref op'>[]</span> <span class='code identifier id'>code</span> <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='dstring node'>&quot;Code must be a one-character string, not #{code}&quot;</span> <span class='unless unless_mod kw'>unless</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='String constant id'>String</span> <span class='and and kw'>and</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='size identifier id'>size</span> <span class='eq op'>==</span> <span class='integer val'>1</span> - <span class='comment val'># note that code[0] is just converting the one-character string into an integer </span> - <span class='comment val'># char value that the underlying java can deal with</span> - <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getSubfield identifier id'>getSubfield</span><span class='lparen token'>(</span><span class='code identifier id'>code</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='getData identifier id'>getData</span> + <span class='comment val'># need to send a char value that the underlying java can deal with</span> + <span class='sub identifier id'>sub</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getSubfield identifier id'>getSubfield</span><span class='lparen token'>(</span><span class='code identifier id'>code</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='ord identifier id'>ord</span><span class='rparen token'>)</span> + <span class='if if kw'>if</span> <span class='lparen token'>(</span><span class='sub identifier id'>sub</span><span class='rparen token'>)</span> + <span class='return return kw'>return</span> <span class='sub identifier id'>sub</span><span class='dot token'>.</span><span class='getData identifier id'>getData</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='end end kw'>end</span> </pre> </td> </tr> </table> </div> <div class="method_details "> + <p class="signature " id="controlField?-instance_method"> + + - (<tt>Boolean</tt>) <strong>controlField?</strong> + + + +</p><div class="docstring"> + <div class="discussion"> + + + </div> +</div> +<div class="tags"> + <h3>Returns:</h3> +<ul class="return"> + + <li> + + <span class='type'>(<tt>Boolean</tt>)</span> + + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +390 +391 +392</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 390</span> + +<span class='def def kw'>def</span> <span class='controlField? fid id'>controlField?</span> + <span class='return return kw'>return</span> <span class='false false kw'>false</span> +<span class='end end kw'>end</span> +</pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> <p class="signature " id="each-instance_method"> - (<tt>Object</tt>) <strong>each</strong> @@ -400,18 +525,18 @@ <tr> <td> <pre class="lines"> -345 -346 -347 -348 -349</pre> +482 +483 +484 +485 +486</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 345</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 482</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='getSubfields identifier id'>getSubfields</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='s identifier id'>s</span><span class='bitor op'>|</span> <span class='yield yield kw'>yield</span> <span class='s identifier id'>s</span> <span class='end end kw'>end</span> @@ -444,16 +569,16 @@ <tr> <td> <pre class="lines"> -335 -336 -337</pre> +472 +473 +474</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 335</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 472</span> <span class='def def kw'>def</span> <span class='indicator1 identifier id'>indicator1</span> <span class='return return kw'>return</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getIndicator1 identifier id'>getIndicator1</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span> <span class='end end kw'>end</span> </pre> @@ -484,16 +609,16 @@ <tr> <td> <pre class="lines"> -340 -341 -342</pre> +477 +478 +479</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 340</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 477</span> <span class='def def kw'>def</span> <span class='indicator2 identifier id'>indicator2</span> <span class='return return kw'>return</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getIndicator2 identifier id'>getIndicator2</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span> <span class='end end kw'>end</span> </pre> @@ -608,28 +733,56 @@ <tr> <td> <pre class="lines"> -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332</pre> +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 321</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 444</span> <span class='def def kw'>def</span> <span class='sub_values identifier id'>sub_values</span><span class='lparen token'>(</span><span class='code identifier id'>code</span><span class='comma token'>,</span> <span class='myorder identifier id'>myorder</span> <span class='assign token'>=</span> <span class='false false kw'>false</span><span class='rparen token'>)</span> - <span class='code identifier id'>code</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='code identifier id'>code</span><span class='rbrack token'>]</span> <span class='unless unless_mod kw'>unless</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Array constant id'>Array</span> + + <span class='comment val'># Do a little razzle-dazzle for the common case when a single code is given</span> + <span class='if if kw'>if</span> <span class='not not kw'>not</span> <span class='lbrack token'>[</span><span class='Set constant id'>Set</span><span class='comma token'>,</span> <span class='Array constant id'>Array</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='class identifier id'>class</span> + <span class='c identifier id'>c</span> <span class='assign token'>=</span> <span class='code identifier id'>code</span> + <span class='elsif elsif kw'>elsif</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='size identifier id'>size</span> <span class='eq op'>==</span> <span class='integer val'>1</span> + <span class='c identifier id'>c</span> <span class='assign token'>=</span> <span class='code identifier id'>code</span><span class='dot token'>.</span><span class='first identifier id'>first</span> + <span class='end end kw'>end</span> + <span class='if if kw'>if</span> <span class='c identifier id'>c</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='s identifier id'>s</span><span class='bitor op'>|</span> <span class='c identifier id'>c</span> <span class='eq op'>==</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='code identifier id'>code</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='s identifier id'>s</span><span class='bitor op'>|</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='data identifier id'>data</span><span class='rbrace token'>}</span> + <span class='end end kw'>end</span> + + <span class='comment val'># unless [Set, Array].include? code.class</span> + <span class='comment val'># code = [code] </span> + <span class='comment val'># # puts &quot;Arrayified for code #{code} / #{code.class}&quot;</span> + <span class='comment val'># end</span> <span class='if if kw'>if</span> <span class='myorder identifier id'>myorder</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='code identifier id'>code</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='c identifier id'>c</span><span class='bitor op'>|</span> <span class='subs identifier id'>subs</span> <span class='lshft op'>&lt;&lt;</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='s identifier id'>s</span><span class='bitor op'>|</span> <span class='c identifier id'>c</span> <span class='eq op'>==</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='code identifier id'>code</span><span class='rbrace token'>}</span> <span class='end end kw'>end</span> @@ -706,20 +859,20 @@ <tr> <td> <pre class="lines"> -285 -286 -287 -288 -289 -290 -291</pre> +404 +405 +406 +407 +408 +409 +410</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 285</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 404</span> <span class='def def kw'>def</span> <span class='to_s identifier id'>to_s</span> <span class='lparen token'>(</span><span class='joiner identifier id'>joiner</span> <span class='assign token'>=</span> <span class='string val'>' '</span><span class='rparen token'>)</span> <span class='arr identifier id'>arr</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='tag identifier id'>tag</span> <span class='plus op'>+</span> <span class='string val'>' '</span> <span class='plus op'>+</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='indicator1 identifier id'>indicator1</span> <span class='plus op'>+</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='indicator2 identifier id'>indicator2</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='s identifier id'>s</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='s identifier id'>s</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> @@ -778,17 +931,17 @@ <tr> <td> <pre class="lines"> -353 -354 -355 -356</pre> +490 +491 +492 +493</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 353</span> + <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 490</span> <span class='def def kw'>def</span> <span class='value identifier id'>value</span> <span class='joiner identifier id'>joiner</span><span class='assign token'>=</span><span class='string val'>' '</span> <span class='data identifier id'>data</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='getSubfields identifier id'>getSubfields</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='s identifier id'>s</span><span class='bitor op'>|</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='data identifier id'>data</span><span class='rbrace token'>}</span> <span class='return return kw'>return</span> <span class='data identifier id'>data</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='joiner identifier id'>joiner</span><span class='rparen token'>)</span> <span class='end end kw'>end</span> @@ -796,78 +949,15 @@ </td> </tr> </table> </div> - <div class="method_details "> - <p class="signature " id="via_tagspec-instance_method"> - - - (<tt>Object</tt>) <strong>via_tagspec</strong>(tagspec) - - - -</p><table class="source_code"> - <tr> - <td> - <pre class="lines"> - - -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279</pre> - </td> - <td> - <pre class="code"><span class="info file"># File 'lib/marc4j4r.rb', line 260</span> - -<span class='def def kw'>def</span> <span class='via_tagspec identifier id'>via_tagspec</span> <span class='lparen token'>(</span><span class='tagspec identifier id'>tagspec</span><span class='rparen token'>)</span> - <span class='if if kw'>if</span> <span class='lparen token'>(</span><span class='tagspec identifier id'>tagspec</span><span class='dot token'>.</span><span class='_subs identifier id'>_subs</span> <span class='eq op'>==</span> <span class='nil nil kw'>nil</span><span class='rparen token'>)</span> <span class='or or kw'>or</span> <span class='lparen token'>(</span><span class='tagspec identifier id'>tagspec</span><span class='dot token'>.</span><span class='_subs identifier id'>_subs</span><span class='dot token'>.</span><span class='length identifier id'>length</span> <span class='eq op'>==</span> <span class='integer val'>0</span><span class='rparen token'>)</span> - <span class='if if kw'>if</span> <span class='lparen token'>(</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='dot token'>.</span><span class='length identifier id'>length</span> <span class='gt op'>&gt;</span> <span class='integer val'>0</span><span class='rparen token'>)</span> - <span class='return return kw'>return</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='lparen token'>(</span><span class='tagspec identifier id'>tagspec</span><span class='dot token'>.</span><span class='joiner identifier id'>joiner</span><span class='rparen 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='str identifier id'>str</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span> - <span class='comment val'># str = &quot;&quot;</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='s identifier id'>s</span><span class='bitor op'>|</span> - <span class='if if kw'>if</span> <span class='tagspec identifier id'>tagspec</span><span class='dot token'>.</span><span class='_subs identifier id'>_subs</span><span class='lbrack token'>[</span><span class='s identifier id'>s</span><span class='dot token'>.</span><span class='getCode identifier id'>getCode</span><span class='rbrack token'>]</span> - <span class='str identifier id'>str</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='data identifier id'>data</span> <span class='if if_mod kw'>if</span> <span class='s identifier id'>s</span><span class='dot token'>.</span><span class='data identifier id'>data</span><span class='dot token'>.</span><span class='length identifier id'>length</span> <span class='gt op'>&gt;</span> <span class='integer val'>0</span> - <span class='comment val'># str &lt;&lt; tagspec.joiner &lt;&lt; s.data</span> - <span class='end end kw'>end</span> - <span class='end end kw'>end</span> - <span class='return return kw'>return</span> <span class='str identifier id'>str</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='tagspec identifier id'>tagspec</span><span class='dot token'>.</span><span class='joiner identifier id'>joiner</span><span class='rparen token'>)</span> - <span class='comment val'># return str</span> - <span class='end end kw'>end</span> -<span class='end end kw'>end</span> -</pre> - </td> - </tr> -</table> -</div> - </div> </div> <div id="footer"> - Generated on Fri Feb 12 16:38:06 2010 by + Generated on Sat Apr 3 22:01:07 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