oorb 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d55ddf9e9afd0340d680a19dcef13a61cf7db58
4
- data.tar.gz: 022bfa4d33c7cdbd16619e6e77da6c48710656b2
3
+ metadata.gz: a6aefb3c8f8c97b1fc4eeb19ef84fca064d809fb
4
+ data.tar.gz: 50589bef6b59f747a2f75b06bc290097185c4f27
5
5
  SHA512:
6
- metadata.gz: cdabd0136bf3e5a625e43405cdacbe6930b35a1375ca53f98e12e4e10bbb5a43d872e1983d2fdb2eaf79fa76f0d1cff676e4d1aa3c9aee31653c4674576eeede
7
- data.tar.gz: 42214d7494c799654b025fb5f7b15d5e4eec74a9f8d2095f3af55cd852f71d21ae5b7382d3adcd44dc93cb0361e14c4748d401b14741af2c358680c61c1ed0f0
6
+ metadata.gz: 367114c7b883d27860355daa97b8f15df9583c68959bd56848cc8902671fe6cad5dc43a362888e01bea19b9fbc653dc488562a727f9380bb6c265d08fb088fe4
7
+ data.tar.gz: 22a1823de6b17fb8a38280c7b6cc626a13e557080e4a9e0832b8ded09680cbce51d06460a51fdf159fd6b32323b864d8853332d17d8f0ce1af2df7583b0642e5
data/.yardopts CHANGED
@@ -1 +1 @@
1
- yardoc -r --no-private lib/**/*.rb - LICENSE.txt CODE_OF_CONDUCT.md --exclude lib/oorb/version.rb
1
+ yardoc --no-private lib/**/*.rb - LICENSE.txt CODE_OF_CONDUCT.md --exclude lib/oorb/version.rb
@@ -168,7 +168,7 @@
168
168
  <li class="public ">
169
169
  <span class="summary_signature">
170
170
 
171
- <a href="#build_collection-instance_method" title="#build_collection (instance method)">- (Object) <strong>build_collection</strong>(character) </a>
171
+ <a href="#build_collection-instance_method" title="#build_collection (instance method)">- (String) <strong>build_collection</strong>(character) </a>
172
172
 
173
173
 
174
174
 
@@ -192,7 +192,7 @@
192
192
  <li class="public ">
193
193
  <span class="summary_signature">
194
194
 
195
- <a href="#build_regex-instance_method" title="#build_regex (instance method)">- (Object) <strong>build_regex</strong>(input) </a>
195
+ <a href="#build_regex-instance_method" title="#build_regex (instance method)">- (String) <strong>build_regex</strong>(input) </a>
196
196
 
197
197
 
198
198
 
@@ -216,7 +216,7 @@
216
216
  <li class="public ">
217
217
  <span class="summary_signature">
218
218
 
219
- <a href="#combine_whitespace-instance_method" title="#combine_whitespace (instance method)">- (Object) <strong>combine_whitespace</strong>(string) </a>
219
+ <a href="#combine_whitespace-instance_method" title="#combine_whitespace (instance method)">- (String) <strong>combine_whitespace</strong>(string) </a>
220
220
 
221
221
 
222
222
 
@@ -241,7 +241,7 @@ whitespace character.</p>
241
241
  <li class="public ">
242
242
  <span class="summary_signature">
243
243
 
244
- <a href="#escape-instance_method" title="#escape (instance method)">- (Object) <strong>escape</strong>(character) </a>
244
+ <a href="#escape-instance_method" title="#escape (instance method)">- (String) <strong>escape</strong>(character) </a>
245
245
 
246
246
 
247
247
 
@@ -298,7 +298,7 @@ whitespace character.</p>
298
298
  <div class="method_details first">
299
299
  <h3 class="signature first" id="build_collection-instance_method">
300
300
 
301
- - (<tt>Object</tt>) <strong>build_collection</strong>(character)
301
+ - (<tt>String</tt>) <strong>build_collection</strong>(character)
302
302
 
303
303
 
304
304
 
@@ -307,14 +307,69 @@ whitespace character.</p>
307
307
  </h3><div class="docstring">
308
308
  <div class="discussion">
309
309
 
310
- <p>Builds a group match from an input letter. Raises an argument error if the
311
- letter isn&#39;t from the LETTERS hash</p>
310
+ <p>Builds a group match from an input letter.</p>
312
311
 
313
312
 
314
313
  </div>
315
314
  </div>
316
315
  <div class="tags">
316
+ <p class="tag_title">Parameters:</p>
317
+ <ul class="param">
318
+
319
+ <li>
320
+
321
+ <span class='name'>character</span>
322
+
323
+
324
+ <span class='type'>(<tt>String</tt>)</span>
325
+
326
+
327
+
328
+ &mdash;
329
+ <div class='inline'>
330
+ <p>made of a single character</p>
331
+ </div>
332
+
333
+ </li>
317
334
 
335
+ </ul>
336
+
337
+ <p class="tag_title">Returns:</p>
338
+ <ul class="return">
339
+
340
+ <li>
341
+
342
+
343
+ <span class='type'>(<tt>String</tt>)</span>
344
+
345
+
346
+
347
+ &mdash;
348
+ <div class='inline'>
349
+ <p>collection of commonly mis-ocr&#39;d characters bounded by square brackets</p>
350
+ </div>
351
+
352
+ </li>
353
+
354
+ </ul>
355
+ <p class="tag_title">Raises:</p>
356
+ <ul class="raise">
357
+
358
+ <li>
359
+
360
+
361
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
362
+
363
+
364
+
365
+ &mdash;
366
+ <div class='inline'>
367
+ <p>if the argument isn&#39;t a single character string</p>
368
+ </div>
369
+
370
+ </li>
371
+
372
+ </ul>
318
373
 
319
374
  </div><table class="source_code">
320
375
  <tr>
@@ -322,16 +377,16 @@ letter isn&#39;t from the LETTERS hash</p>
322
377
  <pre class="lines">
323
378
 
324
379
 
325
- 55
326
- 56
327
- 57
328
- 58
329
- 59
330
- 60
331
- 61</pre>
380
+ 61
381
+ 62
382
+ 63
383
+ 64
384
+ 65
385
+ 66
386
+ 67</pre>
332
387
  </td>
333
388
  <td>
334
- <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 55</span>
389
+ <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 61</span>
335
390
 
336
391
  <span class='kw'>def</span> <span class='id identifier rubyid_build_collection'>build_collection</span><span class='lparen'>(</span><span class='id identifier rubyid_character'>character</span><span class='rparen'>)</span>
337
392
  <span class='kw'>unless</span> <span class='const'>LETTERS</span><span class='lbracket'>[</span><span class='id identifier rubyid_character'>character</span><span class='rbracket'>]</span>
@@ -348,7 +403,7 @@ letter isn&#39;t from the LETTERS hash</p>
348
403
  <div class="method_details ">
349
404
  <h3 class="signature " id="build_regex-instance_method">
350
405
 
351
- - (<tt>Object</tt>) <strong>build_regex</strong>(input)
406
+ - (<tt>String</tt>) <strong>build_regex</strong>(input)
352
407
 
353
408
 
354
409
 
@@ -363,7 +418,46 @@ letter isn&#39;t from the LETTERS hash</p>
363
418
  </div>
364
419
  </div>
365
420
  <div class="tags">
421
+ <p class="tag_title">Parameters:</p>
422
+ <ul class="param">
423
+
424
+ <li>
425
+
426
+ <span class='name'>input</span>
427
+
428
+
429
+ <span class='type'>(<tt>String</tt>)</span>
430
+
431
+
432
+
433
+ &mdash;
434
+ <div class='inline'>
435
+ <p>to be parsed</p>
436
+ </div>
437
+
438
+ </li>
439
+
440
+ </ul>
441
+
442
+ <p class="tag_title">Returns:</p>
443
+ <ul class="return">
444
+
445
+ <li>
446
+
447
+
448
+ <span class='type'>(<tt>String</tt>)</span>
449
+
450
+
451
+
452
+ &mdash;
453
+ <div class='inline'>
454
+ <p>formatted as a valid regular expression optimized for capturing OCR
455
+ mistakes</p>
456
+ </div>
457
+
458
+ </li>
366
459
 
460
+ </ul>
367
461
 
368
462
  </div><table class="source_code">
369
463
  <tr>
@@ -371,14 +465,14 @@ letter isn&#39;t from the LETTERS hash</p>
371
465
  <pre class="lines">
372
466
 
373
467
 
374
- 40
375
- 41
376
468
  42
377
469
  43
378
- 44</pre>
470
+ 44
471
+ 45
472
+ 46</pre>
379
473
  </td>
380
474
  <td>
381
- <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 40</span>
475
+ <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 42</span>
382
476
 
383
477
  <span class='kw'>def</span> <span class='id identifier rubyid_build_regex'>build_regex</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
384
478
  <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_char'>char</span><span class='op'>|</span>
@@ -393,7 +487,7 @@ letter isn&#39;t from the LETTERS hash</p>
393
487
  <div class="method_details ">
394
488
  <h3 class="signature " id="combine_whitespace-instance_method">
395
489
 
396
- - (<tt>Object</tt>) <strong>combine_whitespace</strong>(string)
490
+ - (<tt>String</tt>) <strong>combine_whitespace</strong>(string)
397
491
 
398
492
 
399
493
 
@@ -409,7 +503,45 @@ whitespace character</p>
409
503
  </div>
410
504
  </div>
411
505
  <div class="tags">
506
+ <p class="tag_title">Parameters:</p>
507
+ <ul class="param">
412
508
 
509
+ <li>
510
+
511
+ <span class='name'>string</span>
512
+
513
+
514
+ <span class='type'>(<tt>String</tt>)</span>
515
+
516
+
517
+
518
+ &mdash;
519
+ <div class='inline'>
520
+ <p>of any length</p>
521
+ </div>
522
+
523
+ </li>
524
+
525
+ </ul>
526
+
527
+ <p class="tag_title">Returns:</p>
528
+ <ul class="return">
529
+
530
+ <li>
531
+
532
+
533
+ <span class='type'>(<tt>String</tt>)</span>
534
+
535
+
536
+
537
+ &mdash;
538
+ <div class='inline'>
539
+ <p>where consecutive whitespace characters have been collapsed</p>
540
+ </div>
541
+
542
+ </li>
543
+
544
+ </ul>
413
545
 
414
546
  </div><table class="source_code">
415
547
  <tr>
@@ -417,12 +549,12 @@ whitespace character</p>
417
549
  <pre class="lines">
418
550
 
419
551
 
420
- 48
421
- 49
422
- 50</pre>
552
+ 52
553
+ 53
554
+ 54</pre>
423
555
  </td>
424
556
  <td>
425
- <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 48</span>
557
+ <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 52</span>
426
558
 
427
559
  <span class='kw'>def</span> <span class='id identifier rubyid_combine_whitespace'>combine_whitespace</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='rparen'>)</span>
428
560
  <span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s+</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
@@ -435,7 +567,7 @@ whitespace character</p>
435
567
  <div class="method_details ">
436
568
  <h3 class="signature " id="escape-instance_method">
437
569
 
438
- - (<tt>Object</tt>) <strong>escape</strong>(character)
570
+ - (<tt>String</tt>) <strong>escape</strong>(character)
439
571
 
440
572
 
441
573
 
@@ -450,7 +582,45 @@ whitespace character</p>
450
582
  </div>
451
583
  </div>
452
584
  <div class="tags">
585
+ <p class="tag_title">Parameters:</p>
586
+ <ul class="param">
587
+
588
+ <li>
589
+
590
+ <span class='name'>character</span>
591
+
592
+
593
+ <span class='type'>(<tt>String</tt>)</span>
594
+
595
+
596
+
597
+ &mdash;
598
+ <div class='inline'>
599
+ <p>made of a single character</p>
600
+ </div>
601
+
602
+ </li>
603
+
604
+ </ul>
605
+
606
+ <p class="tag_title">Returns:</p>
607
+ <ul class="return">
453
608
 
609
+ <li>
610
+
611
+
612
+ <span class='type'>(<tt>String</tt>)</span>
613
+
614
+
615
+
616
+ &mdash;
617
+ <div class='inline'>
618
+ <p>escaped character with whitespace charactions made optional</p>
619
+ </div>
620
+
621
+ </li>
622
+
623
+ </ul>
454
624
 
455
625
  </div><table class="source_code">
456
626
  <tr>
@@ -458,15 +628,15 @@ whitespace character</p>
458
628
  <pre class="lines">
459
629
 
460
630
 
461
- 65
462
- 66
463
- 67
464
- 68
465
- 69
466
- 70</pre>
631
+ 73
632
+ 74
633
+ 75
634
+ 76
635
+ 77
636
+ 78</pre>
467
637
  </td>
468
638
  <td>
469
- <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 65</span>
639
+ <pre class="code"><span class="info file"># File 'lib/oorb.rb', line 73</span>
470
640
 
471
641
  <span class='kw'>def</span> <span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_character'>character</span><span class='rparen'>)</span>
472
642
  <span class='kw'>if</span> <span class='id identifier rubyid_character'>character</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>1</span>
@@ -533,7 +703,7 @@ whitespace character</p>
533
703
  </div>
534
704
 
535
705
  <div id="footer">
536
- Generated on Sat Jun 11 11:35:54 2016 by
706
+ Generated on Sat Jun 11 12:25:54 2016 by
537
707
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
538
708
  0.8.7.6 (ruby-2.3.1).
539
709
  </div>
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Sat Jun 11 11:35:54 2016 by
110
+ Generated on Sat Jun 11 12:25:54 2016 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.8.7.6 (ruby-2.3.1).
113
113
  </div>
@@ -118,7 +118,7 @@ href="http://contributor-covenant.org/version/1/3/0/">contributor-covenant.org/v
118
118
  </div></div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Sat Jun 11 11:35:54 2016 by
121
+ Generated on Sat Jun 11 12:25:54 2016 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.8.7.6 (ruby-2.3.1).
124
124
  </div>
@@ -64,7 +64,7 @@
64
64
  <div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2016 Calvyn82<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.</div></div>
65
65
 
66
66
  <div id="footer">
67
- Generated on Sat Jun 11 11:35:54 2016 by
67
+ Generated on Sat Jun 11 12:25:54 2016 by
68
68
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
69
69
  0.8.7.6 (ruby-2.3.1).
70
70
  </div>
@@ -134,7 +134,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
134
134
  </div></div>
135
135
 
136
136
  <div id="footer">
137
- Generated on Sat Jun 11 11:35:54 2016 by
137
+ Generated on Sat Jun 11 12:25:54 2016 by
138
138
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
139
139
  0.8.7.6 (ruby-2.3.1).
140
140
  </div>
@@ -134,7 +134,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
134
134
  </div></div>
135
135
 
136
136
  <div id="footer">
137
- Generated on Sat Jun 11 11:35:54 2016 by
137
+ Generated on Sat Jun 11 12:25:54 2016 by
138
138
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
139
139
  0.8.7.6 (ruby-2.3.1).
140
140
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sat Jun 11 11:35:54 2016 by
106
+ Generated on Sat Jun 11 12:25:54 2016 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.6 (ruby-2.3.1).
109
109
  </div>
@@ -37,6 +37,8 @@ class OORB
37
37
 
38
38
  ##
39
39
  # Builds an OCR optimized regular expression from a string
40
+ # @param input [String] to be parsed
41
+ # @return [String] formatted as a valid regular expression optimized for capturing OCR mistakes
40
42
  def build_regex(input)
41
43
  input.downcase.chars.map do |char|
42
44
  LETTERS.has_key?(char) ? build_collection(char) : escape(char)
@@ -45,13 +47,17 @@ class OORB
45
47
 
46
48
  ##
47
49
  # Collapses mutliple consecutive whitespace characters into a single whitespace character
50
+ # @param string [String] of any length
51
+ # @return [String] where consecutive whitespace characters have been collapsed
48
52
  def combine_whitespace(string)
49
53
  string.gsub(/\s+/, "\s")
50
54
  end
51
55
 
52
56
  ##
53
57
  # Builds a group match from an input letter.
54
- # Raises an argument error if the letter isn't from the LETTERS hash
58
+ # @raise [ArgumentError] if the argument isn't a single character string
59
+ # @param character [String] made of a single character
60
+ # @return [String] collection of commonly mis-ocr'd characters bounded by square brackets
55
61
  def build_collection(character)
56
62
  unless LETTERS[character]
57
63
  raise ArgumentError, "Valid arguments are a single character from #{LETTERS.keys.join(", ")}."
@@ -62,6 +68,8 @@ class OORB
62
68
 
63
69
  ##
64
70
  # Escapes a single-character string and makes whitespace characters optional
71
+ # @param character [String] made of a single character
72
+ # @return [String] escaped character with whitespace charactions made optional
65
73
  def escape(character)
66
74
  if character.length > 1
67
75
  raise ArgumentError, "Argument must be a single character string"
@@ -1,3 +1,3 @@
1
1
  module Oorb
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calvyn82