ofac 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -49
  3. data/lib/ofac/version.rb +1 -0
  4. data/test/test_helper.rb +5 -1
  5. metadata +118 -94
  6. data/.document +0 -5
  7. data/.ruby-gemset +0 -1
  8. data/.ruby-version +0 -1
  9. data/History.txt +0 -134
  10. data/PostInstall.txt +0 -11
  11. data/VERSION.yml +0 -5
  12. data/generators/ofac_migration/.DS_Store +0 -0
  13. data/generators/ofac_migration/ofac_migration_generator.rb +0 -12
  14. data/generators/ofac_migration/templates/.DS_Store +0 -0
  15. data/generators/ofac_migration/templates/migration.rb +0 -31
  16. data/nbproject/project.properties +0 -7
  17. data/nbproject/project.xml +0 -15
  18. data/ofac.gemspec +0 -129
  19. data/rdoc/CreateOfacSdns.html +0 -249
  20. data/rdoc/Ofac.html +0 -434
  21. data/rdoc/OfacMatch.html +0 -299
  22. data/rdoc/OfacMigration.html +0 -138
  23. data/rdoc/OfacMigration/Generators.html +0 -138
  24. data/rdoc/OfacMigration/Generators/BuildGenerator.html +0 -251
  25. data/rdoc/OfacSdn.html +0 -209
  26. data/rdoc/OfacSdnLoader.html +0 -238
  27. data/rdoc/README_rdoc.html +0 -323
  28. data/rdoc/String.html +0 -262
  29. data/rdoc/classes/Ofac.html +0 -411
  30. data/rdoc/classes/OfacMatch.html +0 -239
  31. data/rdoc/classes/OfacSdn.html +0 -111
  32. data/rdoc/classes/OfacSdnLoader.html +0 -190
  33. data/rdoc/classes/String.html +0 -207
  34. data/rdoc/created.rid +0 -10
  35. data/rdoc/files/README_rdoc.html +0 -317
  36. data/rdoc/files/lib/ofac/models/ofac_rb.html +0 -101
  37. data/rdoc/files/lib/ofac/models/ofac_sdn_loader_rb.html +0 -110
  38. data/rdoc/files/lib/ofac/models/ofac_sdn_rb.html +0 -108
  39. data/rdoc/files/lib/ofac/ofac_match_rb.html +0 -101
  40. data/rdoc/files/lib/ofac/ruby_string_extensions_rb.html +0 -101
  41. data/rdoc/files/lib/ofac_rb.html +0 -113
  42. data/rdoc/fr_class_index.html +0 -31
  43. data/rdoc/fr_file_index.html +0 -33
  44. data/rdoc/fr_method_index.html +0 -35
  45. data/rdoc/images/add.png +0 -0
  46. data/rdoc/images/arrow_up.png +0 -0
  47. data/rdoc/images/brick.png +0 -0
  48. data/rdoc/images/brick_link.png +0 -0
  49. data/rdoc/images/bug.png +0 -0
  50. data/rdoc/images/bullet_black.png +0 -0
  51. data/rdoc/images/bullet_toggle_minus.png +0 -0
  52. data/rdoc/images/bullet_toggle_plus.png +0 -0
  53. data/rdoc/images/date.png +0 -0
  54. data/rdoc/images/delete.png +0 -0
  55. data/rdoc/images/find.png +0 -0
  56. data/rdoc/images/loadingAnimation.gif +0 -0
  57. data/rdoc/images/macFFBgHack.png +0 -0
  58. data/rdoc/images/package.png +0 -0
  59. data/rdoc/images/page_green.png +0 -0
  60. data/rdoc/images/page_white_text.png +0 -0
  61. data/rdoc/images/page_white_width.png +0 -0
  62. data/rdoc/images/plugin.png +0 -0
  63. data/rdoc/images/ruby.png +0 -0
  64. data/rdoc/images/tag_blue.png +0 -0
  65. data/rdoc/images/tag_green.png +0 -0
  66. data/rdoc/images/transparent.png +0 -0
  67. data/rdoc/images/wrench.png +0 -0
  68. data/rdoc/images/wrench_orange.png +0 -0
  69. data/rdoc/images/zoom.png +0 -0
  70. data/rdoc/index.html +0 -96
  71. data/rdoc/js/darkfish.js +0 -155
  72. data/rdoc/js/jquery.js +0 -18
  73. data/rdoc/js/navigation.js +0 -142
  74. data/rdoc/js/search.js +0 -94
  75. data/rdoc/js/search_index.js +0 -1
  76. data/rdoc/js/searcher.js +0 -228
  77. data/rdoc/lib/generators/ofac_migration/build/build_generator_rb.html +0 -97
  78. data/rdoc/lib/generators/ofac_migration/build/templates/create_ofac_sdns_rb.html +0 -97
  79. data/rdoc/lib/ofac/models/ofac_rb.html +0 -97
  80. data/rdoc/lib/ofac/models/ofac_sdn_loader_rb.html +0 -97
  81. data/rdoc/lib/ofac/models/ofac_sdn_rb.html +0 -97
  82. data/rdoc/lib/ofac/ofac_match_rb.html +0 -97
  83. data/rdoc/lib/ofac/ruby_string_extensions_rb.html +0 -97
  84. data/rdoc/lib/ofac_rb.html +0 -97
  85. data/rdoc/rdoc-style.css +0 -208
  86. data/rdoc/rdoc.css +0 -595
  87. data/rdoc/table_of_contents.html +0 -120
@@ -1,434 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class Ofac - ofac 2.0.1</title>
8
-
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/ofac/models/ofac.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">Object
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-c-new">::new</a>
77
-
78
- <li ><a href="#method-i-db_hit-3F">#db_hit?</a>
79
-
80
- <li ><a href="#method-i-possible_hits">#possible_hits</a>
81
-
82
- <li ><a href="#method-i-score">#score</a>
83
-
84
- </ul>
85
- </nav>
86
-
87
- </div>
88
-
89
- <div id="project-metadata">
90
- <nav id="fileindex-section" class="section project-section">
91
- <h3 class="section-header">Pages</h3>
92
-
93
- <ul>
94
-
95
- <li class="file"><a href="./README_rdoc.html">README</a>
96
-
97
- </ul>
98
- </nav>
99
-
100
- <nav id="classindex-section" class="section project-section">
101
- <h3 class="section-header">Class and Module Index</h3>
102
-
103
- <ul class="link-list">
104
-
105
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
106
-
107
- <li><a href="./Ofac.html">Ofac</a>
108
-
109
- <li><a href="./OfacMatch.html">OfacMatch</a>
110
-
111
- <li><a href="./OfacMigration.html">OfacMigration</a>
112
-
113
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
114
-
115
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
116
-
117
- <li><a href="./OfacSdn.html">OfacSdn</a>
118
-
119
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
120
-
121
- <li><a href="./String.html">String</a>
122
-
123
- </ul>
124
- </nav>
125
-
126
- </div>
127
- </nav>
128
-
129
- <div id="documentation">
130
- <h1 class="class">class Ofac</h1>
131
-
132
- <div id="description" class="description">
133
-
134
- </div><!-- description -->
135
-
136
-
137
-
138
-
139
- <section id="5Buntitled-5D" class="documentation-section">
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
- <!-- Methods -->
149
-
150
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
151
- <h3 class="section-header">Public Class Methods</h3>
152
-
153
-
154
- <div id="method-c-new" class="method-detail ">
155
-
156
- <div class="method-heading">
157
- <span class="method-name">new</span><span
158
- class="method-args">(identity)</span>
159
-
160
- <span class="method-click-advice">click to toggle source</span>
161
-
162
- </div>
163
-
164
-
165
- <div class="method-description">
166
-
167
- <p>Accepts a hash with the identity&#39;s demographic information</p>
168
-
169
- <pre class="ruby"><span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>({:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Oscar Hernandez&#39;</span>, :<span class="ruby-identifier">city</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Clearwater&#39;</span>, :<span class="ruby-identifier">address</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;123 somewhere ln&#39;</span>})
170
- </pre>
171
-
172
- <p><code>:name</code> is required to get a score. If <code>:name</code> is
173
- missing, an error will not be thrown, but a score of 0 will be returned.</p>
174
-
175
- <p>You can pass a string in for the full name:</p>
176
-
177
- <pre class="ruby"><span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Victor De La Garza&#39;</span>)
178
- </pre>
179
-
180
- <p>Or you can specify the last and first names</p>
181
-
182
- <pre class="ruby"><span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> {:<span class="ruby-identifier">first_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Victor&#39;</span>, :<span class="ruby-identifier">last_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;De La Garza&#39;</span>})
183
- </pre>
184
-
185
- <p>The first method will build a larger list of names for ruby to parse
186
- through and more likely to find similar names. The second method is
187
- quicker.</p>
188
-
189
- <p>The more information provided, the higher the score could be. A score of
190
- 100 would mean all fields were passed in, and all fields were 100% matches.
191
- If only the name is passed in without an address, it will be impossible to
192
- get a score of 100, even if the name matches perfectly.</p>
193
-
194
- <p>Acceptable hash keys and their weighting in score calculation:</p>
195
- <ul><li>
196
- <p><code>:name</code> (weighting = 60%) (required) This can be a person,
197
- business, or marine vessel</p>
198
- </li><li>
199
- <p><code>:address</code> (weighting = 10%)</p>
200
- </li><li>
201
- <p><code>:city</code> (weighting = 30%)</p>
202
- </li></ul>
203
-
204
-
205
-
206
-
207
- <div class="method-source-code" id="new-source">
208
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac.rb, line 28</span>
209
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">identity</span>)
210
- <span class="ruby-ivar">@identity</span> = <span class="ruby-identifier">identity</span>
211
- <span class="ruby-keyword">end</span></pre>
212
- </div><!-- new-source -->
213
-
214
- </div>
215
-
216
-
217
-
218
-
219
- </div><!-- new-method -->
220
-
221
-
222
- </section><!-- public-class-method-details -->
223
-
224
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
225
- <h3 class="section-header">Public Instance Methods</h3>
226
-
227
-
228
- <div id="method-i-db_hit-3F" class="method-detail ">
229
-
230
- <div class="method-heading">
231
- <span class="method-name">db_hit?</span><span
232
- class="method-args">()</span>
233
-
234
- <span class="method-click-advice">click to toggle source</span>
235
-
236
- </div>
237
-
238
-
239
- <div class="method-description">
240
-
241
-
242
-
243
-
244
-
245
-
246
- <div class="method-source-code" id="db_hit-3F-source">
247
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac.rb, line 89</span>
248
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">db_hit?</span>
249
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@identity</span>[<span class="ruby-value">:name</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">blank?</span>
250
-
251
- <span class="ruby-comment">#first get a list from the database of possible matches by name</span>
252
- <span class="ruby-comment">#this query is pretty liberal, we just want to get a list of possible</span>
253
- <span class="ruby-comment">#matches from the database that we can run through our ruby matching algorithm</span>
254
- <span class="ruby-identifier">hit</span> = <span class="ruby-keyword">false</span>
255
- <span class="ruby-identifier">name_array</span> = <span class="ruby-identifier">process_name</span>
256
-
257
- <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">delete_if</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">2</span>}
258
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">empty?</span>
259
- <span class="ruby-identifier">hit</span> = <span class="ruby-constant">OfacSdn</span>.<span class="ruby-identifier">possible_sdns</span>(<span class="ruby-identifier">name_array</span>).<span class="ruby-identifier">exists?</span>
260
- <span class="ruby-keyword">end</span>
261
- <span class="ruby-keyword">end</span>
262
- <span class="ruby-identifier">hit</span>
263
- <span class="ruby-keyword">end</span></pre>
264
- </div><!-- db_hit-3F-source -->
265
-
266
- </div>
267
-
268
-
269
-
270
-
271
- </div><!-- db_hit-3F-method -->
272
-
273
-
274
- <div id="method-i-possible_hits" class="method-detail ">
275
-
276
- <div class="method-heading">
277
- <span class="method-name">possible_hits</span><span
278
- class="method-args">()</span>
279
-
280
- <span class="method-click-advice">click to toggle source</span>
281
-
282
- </div>
283
-
284
-
285
- <div class="method-description">
286
-
287
- <pre class="ruby"><span class="ruby-constant">Returns</span> <span class="ruby-identifier">an</span> <span class="ruby-identifier">array</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">hashes</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">records</span> <span class="ruby-keyword">in</span> <span class="ruby-identifier">the</span> <span class="ruby-constant">OFAC</span> <span class="ruby-identifier">data</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">found</span> <span class="ruby-identifier">partial</span> <span class="ruby-identifier">matches</span> <span class="ruby-identifier">with</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">record</span><span class="ruby-string">&#39;s score.
288
-
289
- Ofac.new({:name =&gt; &#39;</span><span class="ruby-constant">Oscar</span> <span class="ruby-constant">Hernandez</span><span class="ruby-string">&#39;, :city =&gt; &#39;</span><span class="ruby-constant">Clearwater</span><span class="ruby-string">&#39;, :address =&gt; &#39;</span><span class="ruby-value">123</span> <span class="ruby-identifier">somewhere</span> <span class="ruby-identifier">ln</span><span class="ruby-string">&#39;}).possible_hits
290
- </span></pre>
291
-
292
- <p>returns</p>
293
-
294
- <pre class="ruby">[{:<span class="ruby-identifier">address=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;123 Somewhere Ln&quot;</span>, :<span class="ruby-identifier">score=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">100</span>, :<span class="ruby-identifier">name=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;HERNANDEZ, Oscar|GUAMATUR, S.A.&quot;</span>, :<span class="ruby-identifier">city=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;Clearwater&quot;</span>}, {:<span class="ruby-identifier">address=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;123 Somewhere Ln&quot;</span>, :<span class="ruby-identifier">score=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">100</span>, :<span class="ruby-identifier">name=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;HERNANDEZ, Oscar|Alternate Name&quot;</span>, :<span class="ruby-identifier">city=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;Clearwater&quot;</span>}]
295
- </pre>
296
-
297
-
298
-
299
-
300
- <div class="method-source-code" id="possible_hits-source">
301
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac.rb, line 112</span>
302
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">possible_hits</span>
303
- <span class="ruby-ivar">@possible_hits</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">retrieve_possible_hits</span>
304
- <span class="ruby-keyword">end</span></pre>
305
- </div><!-- possible_hits-source -->
306
-
307
- </div>
308
-
309
-
310
-
311
-
312
- </div><!-- possible_hits-method -->
313
-
314
-
315
- <div id="method-i-score" class="method-detail ">
316
-
317
- <div class="method-heading">
318
- <span class="method-name">score</span><span
319
- class="method-args">()</span>
320
-
321
- <span class="method-click-advice">click to toggle source</span>
322
-
323
- </div>
324
-
325
-
326
- <div class="method-description">
327
-
328
- <p>Creates a score, 1 - 100, based on how well the name and address match the
329
- data on the SDN (Specially Designated Nationals) list.</p>
330
-
331
- <p>The score is calculated by adding up the weightings of each part that is
332
- matched. So if only name is matched, then the max score is the weight for
333
- <code>:name</code> which is 60</p>
334
-
335
- <p>It&#39;s possible to get partial matches, which will add partial weight to
336
- the score. If there is not a match on the element as it is passed in, then
337
- each word element gets broken down and matches are tried on each partial
338
- element. The weighting is distrubuted equally for each partial that is
339
- matched.</p>
340
-
341
- <p>If exact matches are not made, then a sounds like match is attempted. Any
342
- match made by sounds like is given 75% of it&#39;s weight to the score.</p>
343
-
344
- <p>Example:</p>
345
-
346
- <p>If you are trying to match the name Kevin Tyll and there is a record for
347
- Smith, Kevin in the database, then we will try to match both Kevin and Tyll
348
- separately, with each element Smith and Kevin. Since only Kevin will find
349
- a match, and there were 2 elements in the searched name, the score will be
350
- added by half the weighting for <code>:name</code>. So since the weight
351
- for <code>:name</code> is 60, then we will add 30 to the score.</p>
352
-
353
- <p>If you are trying to match the name Kevin Gregory Tyll and there is a
354
- record for Tyll, Kevin in the database, then we will try to match Kevin and
355
- Gregory and Tyll separately, with each element Tyll and Kevin. Since both
356
- Kevin and Tyll will find a match, and there were 3 elements in the searched
357
- name, the score will be added by 2/3 the weighting for <code>:name</code>.
358
- So since the weight for <code>:name</code> is 60, then we will add 40 to
359
- the score.</p>
360
-
361
- <p>If you are trying to match the name Kevin Tyll and there is a record for
362
- Kevin Gregory Tyll in the database, then we will try to match Kevin and
363
- Tyll separately, with each element Tyll and Kevin and Gregory. Since both
364
- Kevin and Tyll will find a match, and there were 2 elements in the searched
365
- name, the score will be added by 2/2 the weighting for <code>:name</code>.
366
- So since the weight for <code>:name</code> is 60, then we will add 60 to
367
- the score.</p>
368
-
369
- <p>If you are trying to match the name Kevin Tyll, and there is a record for
370
- Teel, Kevin in the database, then an exact match will be found for Kevin,
371
- and a sounds like match will be made for Tyll. Since there were 2 elements
372
- in the searched name, and the weight for <code>:name</code> is 60, then
373
- each element is worth 30. Since Kevin was an exact match, it will add 30,
374
- and since Tyll was a sounds like match, it will add 30 * .75. So the
375
- <code>:name</code> portion of the search will be worth 53.</p>
376
-
377
- <p>If data is in the database for city and or address, and you pass data in
378
- for these elements, the score will be reduced by 10% of the weight if there
379
- is no match or sounds like match. So if you get a match on name,
380
- you&#39;ve already got a score of 60. So if you don&#39;t pass in an
381
- address or city, or if you do, but there is no city or address info in the
382
- database, then your final score will be 60. But if you do pass in a city,
383
- say Tampa, and the city in the Database is New York, then we will deduct
384
- 10% of the weight (30 * .1) = 3 from the score since 30 is the weight for
385
- <code>:city</code>. So the final score will be 57.</p>
386
-
387
- <p>If were searching for New York, and the database had New Deli, then there
388
- would be a match on New, but not on Deli. Since there were 2 elements in
389
- the searched city, each hit is worth 15. So the match on New would add 15,
390
- but the non-match on York would subtract (15 * .1) = 1.5 from the score.
391
- So the score would be (60 + 15 - 1.5) = 74, due to rounding.</p>
392
-
393
- <p>Only <code>:city</code> and <code>:address</code> subtract from the score,
394
- No match on name simply returns 0.</p>
395
-
396
- <p>Matches for name are made for both the name and any aliases in the OFAC
397
- database.</p>
398
-
399
- <p>Matches for <code>:city</code> and <code>:address</code> will only be added
400
- to the score if there is first a match on <code>:name</code>.</p>
401
-
402
- <p>We consider a score of 60 to be reasonable as a hit.</p>
403
-
404
-
405
-
406
-
407
- <div class="method-source-code" id="score-source">
408
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac.rb, line 85</span>
409
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">score</span>
410
- <span class="ruby-ivar">@score</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">calculate_score</span>
411
- <span class="ruby-keyword">end</span></pre>
412
- </div><!-- score-source -->
413
-
414
- </div>
415
-
416
-
417
-
418
-
419
- </div><!-- score-method -->
420
-
421
-
422
- </section><!-- public-instance-method-details -->
423
-
424
- </section><!-- 5Buntitled-5D -->
425
-
426
- </div><!-- documentation -->
427
-
428
-
429
- <footer id="validator-badges">
430
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
431
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
432
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
433
- </footer>
434
-
@@ -1,299 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class OfacMatch - ofac 2.0.1</title>
8
-
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/ofac/ofac_match.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">Object
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-c-new">::new</a>
77
-
78
- <li ><a href="#method-i-score">#score</a>
79
-
80
- </ul>
81
- </nav>
82
-
83
- </div>
84
-
85
- <div id="project-metadata">
86
- <nav id="fileindex-section" class="section project-section">
87
- <h3 class="section-header">Pages</h3>
88
-
89
- <ul>
90
-
91
- <li class="file"><a href="./README_rdoc.html">README</a>
92
-
93
- </ul>
94
- </nav>
95
-
96
- <nav id="classindex-section" class="section project-section">
97
- <h3 class="section-header">Class and Module Index</h3>
98
-
99
- <ul class="link-list">
100
-
101
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
102
-
103
- <li><a href="./Ofac.html">Ofac</a>
104
-
105
- <li><a href="./OfacMatch.html">OfacMatch</a>
106
-
107
- <li><a href="./OfacMigration.html">OfacMigration</a>
108
-
109
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
110
-
111
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
112
-
113
- <li><a href="./OfacSdn.html">OfacSdn</a>
114
-
115
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
116
-
117
- <li><a href="./String.html">String</a>
118
-
119
- </ul>
120
- </nav>
121
-
122
- </div>
123
- </nav>
124
-
125
- <div id="documentation">
126
- <h1 class="class">class OfacMatch</h1>
127
-
128
- <div id="description" class="description">
129
-
130
- </div><!-- description -->
131
-
132
-
133
-
134
-
135
- <section id="5Buntitled-5D" class="documentation-section">
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
- <!-- Attributes -->
144
- <section id="attribute-method-details" class="method-section section">
145
- <h3 class="section-header">Attributes</h3>
146
-
147
-
148
- <div id="attribute-i-possible_hits" class="method-detail">
149
- <div class="method-heading attribute-method-heading">
150
- <span class="method-name">possible_hits</span><span
151
- class="attribute-access-type">[R]</span>
152
- </div>
153
-
154
- <div class="method-description">
155
-
156
-
157
-
158
- </div>
159
- </div>
160
-
161
- </section><!-- attribute-method-details -->
162
-
163
-
164
- <!-- Methods -->
165
-
166
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
167
- <h3 class="section-header">Public Class Methods</h3>
168
-
169
-
170
- <div id="method-c-new" class="method-detail ">
171
-
172
- <div class="method-heading">
173
- <span class="method-name">new</span><span
174
- class="method-args">(stats={})</span>
175
-
176
- <span class="method-click-advice">click to toggle source</span>
177
-
178
- </div>
179
-
180
-
181
- <div class="method-description">
182
-
183
- <p>Intialize a Match object with a record hash of fields you want to match on.
184
- Each key in the hash, also has a data hash value for the weight, token, and
185
- type.</p>
186
-
187
- <pre class="ruby"> <span class="ruby-identifier">match</span> = <span class="ruby-constant">Ofac</span><span class="ruby-operator">::</span><span class="ruby-constant">Match</span>.<span class="ruby-identifier">new</span>({:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> {:<span class="ruby-identifier">weight</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, :<span class="ruby-identifier">token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Kevin Tyll&#39;</span>},
188
- :<span class="ruby-identifier">city</span> =<span class="ruby-operator">&gt;</span> {:<span class="ruby-identifier">weight</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">40</span>, :<span class="ruby-identifier">token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Clearwater&#39;</span>, },
189
- :<span class="ruby-identifier">address</span> =<span class="ruby-operator">&gt;</span> {:<span class="ruby-identifier">weight</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">40</span>, :<span class="ruby-identifier">token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;1234 Park St.&#39;</span>, },
190
- :<span class="ruby-identifier">zip</span> =<span class="ruby-operator">&gt;</span> {:<span class="ruby-identifier">weight</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, :<span class="ruby-identifier">token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;33759&#39;</span>, :<span class="ruby-identifier">type</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">number</span>}})
191
-
192
- <span class="ruby-identifier">data</span> <span class="ruby-identifier">hash</span> <span class="ruby-identifier">keys</span><span class="ruby-operator">:</span>
193
- <span class="ruby-operator">*</span> <span class="ruby-operator">&lt;</span><span class="ruby-identifier">tt</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">data</span>[:<span class="ruby-identifier">weight</span>]<span class="ruby-operator">&lt;</span><span class="ruby-regexp">/tt&gt; - value to apply to the score if there is a match (Default is 100/</span><span class="ruby-identifier">umber</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">keys</span> <span class="ruby-keyword">in</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">record</span> <span class="ruby-identifier">hash</span>)
194
- <span class="ruby-operator">*</span> <span class="ruby-operator">&lt;</span><span class="ruby-identifier">tt</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">data</span>[:<span class="ruby-identifier">token</span>]<span class="ruby-operator">&lt;</span><span class="ruby-regexp">/tt&gt; - string to match
195
- * &lt;tt&gt;data[:match]&lt;/</span><span class="ruby-identifier">tt</span><span class="ruby-operator">&gt;</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">set</span> <span class="ruby-identifier">from</span> <span class="ruby-identifier">records</span> <span class="ruby-identifier">hash</span>
196
- <span class="ruby-operator">*</span> <span class="ruby-operator">&lt;</span><span class="ruby-identifier">tt</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">data</span>[:<span class="ruby-identifier">score</span>]<span class="ruby-operator">&lt;</span><span class="ruby-regexp">/tt&gt; - output field
197
- * &lt;tt&gt;data[:type]&lt;/</span><span class="ruby-identifier">tt</span><span class="ruby-operator">&gt;</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">type</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">match</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">should</span> <span class="ruby-identifier">be</span> <span class="ruby-identifier">performed</span> (<span class="ruby-identifier">valid</span> <span class="ruby-identifier">values</span> <span class="ruby-identifier">are</span> <span class="ruby-operator">+</span>:<span class="ruby-identifier">sound</span><span class="ruby-operator">+</span> <span class="ruby-operator">|</span> <span class="ruby-operator">+</span>:<span class="ruby-identifier">number</span><span class="ruby-operator">+</span>) (<span class="ruby-constant">Default</span> <span class="ruby-identifier">is</span> <span class="ruby-operator">+</span>:<span class="ruby-identifier">sound</span><span class="ruby-operator">+</span>)
198
- </pre>
199
-
200
-
201
-
202
-
203
- <div class="method-source-code" id="new-source">
204
- <pre><span class="ruby-comment"># File lib/ofac/ofac_match.rb, line 19</span>
205
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">stats</span>={})
206
- <span class="ruby-ivar">@possible_hits</span> = []
207
- <span class="ruby-ivar">@stats</span> = <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">dup</span>
208
- <span class="ruby-identifier">weight</span> = <span class="ruby-value">100</span>
209
- <span class="ruby-identifier">weight</span> = <span class="ruby-value">100</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@stats</span>.<span class="ruby-identifier">length</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@stats</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
210
- <span class="ruby-ivar">@stats</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
211
- <span class="ruby-identifier">data</span>[<span class="ruby-value">:weight</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">weight</span>
212
- <span class="ruby-identifier">data</span>[<span class="ruby-value">:match</span>] <span class="ruby-operator">||=</span> <span class="ruby-string">&#39;&#39;</span>
213
- <span class="ruby-identifier">data</span>[<span class="ruby-value">:type</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">:sound</span>
214
- <span class="ruby-identifier">data</span>[<span class="ruby-value">:score</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
215
- <span class="ruby-identifier">data</span>[<span class="ruby-value">:token</span>] = <span class="ruby-identifier">data</span>[<span class="ruby-value">:token</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
216
- <span class="ruby-keyword">end</span>
217
- <span class="ruby-keyword">end</span></pre>
218
- </div><!-- new-source -->
219
-
220
- </div>
221
-
222
-
223
-
224
-
225
- </div><!-- new-method -->
226
-
227
-
228
- </section><!-- public-class-method-details -->
229
-
230
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
231
- <h3 class="section-header">Public Instance Methods</h3>
232
-
233
-
234
- <div id="method-i-score" class="method-detail ">
235
-
236
- <div class="method-heading">
237
- <span class="method-name">score</span><span
238
- class="method-args">(match_records)</span>
239
-
240
- <span class="method-click-advice">click to toggle source</span>
241
-
242
- </div>
243
-
244
-
245
- <div class="method-description">
246
-
247
- <p>match_records is an array of hashes.</p>
248
-
249
- <p>The hash keys must match the record hash keys set when initialized.</p>
250
-
251
- <p>score will return the highest score of all the records that are sent in
252
- match_records.</p>
253
-
254
-
255
-
256
-
257
- <div class="method-source-code" id="score-source">
258
- <pre><span class="ruby-comment"># File lib/ofac/ofac_match.rb, line 39</span>
259
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">score</span>(<span class="ruby-identifier">match_records</span>)
260
- <span class="ruby-identifier">score_results</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
261
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">match_records</span>.<span class="ruby-identifier">empty?</span>
262
- <span class="ruby-comment">#place the match_records information</span>
263
- <span class="ruby-comment">#into our @stats hash</span>
264
- <span class="ruby-identifier">match_records</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
265
- <span class="ruby-identifier">match</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
266
- <span class="ruby-ivar">@stats</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span>][<span class="ruby-value">:match</span>] = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
267
- <span class="ruby-keyword">end</span>
268
- <span class="ruby-identifier">record_score</span> = <span class="ruby-identifier">calculate_record</span>
269
- <span class="ruby-identifier">score_results</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">record_score</span>)
270
- <span class="ruby-ivar">@possible_hits</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:score</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">record_score</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">record_score</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
271
- <span class="ruby-keyword">end</span>
272
- <span class="ruby-identifier">score</span> = <span class="ruby-identifier">score_results</span>.<span class="ruby-identifier">max</span> <span class="ruby-comment">#take max score</span>
273
- <span class="ruby-keyword">end</span>
274
- <span class="ruby-ivar">@possible_hits</span>.<span class="ruby-identifier">uniq!</span>
275
- <span class="ruby-identifier">score</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
276
- <span class="ruby-keyword">end</span></pre>
277
- </div><!-- score-source -->
278
-
279
- </div>
280
-
281
-
282
-
283
-
284
- </div><!-- score-method -->
285
-
286
-
287
- </section><!-- public-instance-method-details -->
288
-
289
- </section><!-- 5Buntitled-5D -->
290
-
291
- </div><!-- documentation -->
292
-
293
-
294
- <footer id="validator-badges">
295
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
296
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
297
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
298
- </footer>
299
-