ofac 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +2 -1
- data/VERSION.yml +1 -1
- data/lib/ofac/models/ofac_sdn_loader.rb +61 -56
- data/ofac.gemspec +50 -13
- data/rdoc/Ofac.html +423 -0
- data/rdoc/OfacMatch.html +282 -0
- data/rdoc/OfacSdn.html +133 -0
- data/rdoc/OfacSdnLoader.html +225 -0
- data/rdoc/README_rdoc.html +267 -0
- data/rdoc/String.html +245 -0
- data/rdoc/created.rid +8 -1
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +83 -21
- data/rdoc/js/darkfish.js +153 -0
- data/rdoc/js/jquery.js +18 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +94 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/lib/ofac/models/ofac_rb.html +89 -0
- data/rdoc/lib/ofac/models/ofac_sdn_loader_rb.html +89 -0
- data/rdoc/lib/ofac/models/ofac_sdn_rb.html +89 -0
- data/rdoc/lib/ofac/ofac_match_rb.html +89 -0
- data/rdoc/lib/ofac/ruby_string_extensions_rb.html +89 -0
- data/rdoc/lib/ofac_rb.html +89 -0
- data/rdoc/rdoc.css +543 -0
- data/rdoc/table_of_contents.html +94 -0
- metadata +52 -19
@@ -0,0 +1,267 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>README</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 class="file">
|
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
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./README_rdoc.html">README</a>
|
53
|
+
|
54
|
+
</ul>
|
55
|
+
</nav>
|
56
|
+
|
57
|
+
<nav id="classindex-section" class="section project-section">
|
58
|
+
<h3 class="section-header">Class and Module Index</h3>
|
59
|
+
|
60
|
+
<ul class="link-list">
|
61
|
+
|
62
|
+
<li><a href="./Ofac.html">Ofac</a>
|
63
|
+
|
64
|
+
<li><a href="./OfacMatch.html">OfacMatch</a>
|
65
|
+
|
66
|
+
<li><a href="./OfacSdn.html">OfacSdn</a>
|
67
|
+
|
68
|
+
<li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
|
69
|
+
|
70
|
+
<li><a href="./String.html">String</a>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</nav>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
</nav>
|
77
|
+
|
78
|
+
<div id="documentation" class="description">
|
79
|
+
|
80
|
+
<h1 id="label-ofac">ofac</h1>
|
81
|
+
<ul><li>
|
82
|
+
<p><a href="http://kevintyll.github.com/ofac">kevintyll.github.com/ofac</a></p>
|
83
|
+
</li><li>
|
84
|
+
<p><a href="http://www.drexel-labs.com">www.drexel-labs.com</a></p>
|
85
|
+
</li><li>
|
86
|
+
<p><a
|
87
|
+
href="http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml">www.treas.gov/offices/enforcement/ofac/sdn/index.shtml</a></p>
|
88
|
+
</li></ul>
|
89
|
+
|
90
|
+
<h2 id="label-DESCRIPTION%3A">DESCRIPTION:</h2>
|
91
|
+
|
92
|
+
<p>ofac is a ruby gem that tries to find a match of a person’s name and
|
93
|
+
address against the Office of Foreign Assets Control’s Specially
|
94
|
+
Designated Nationals list…the so called terrorist watch list.</p>
|
95
|
+
|
96
|
+
<p>This gem, like the ssn_validator gem, started as a need for the company I
|
97
|
+
work for, Clarity Services Inc. We decided once again to create a gem out
|
98
|
+
of it and share it with the community. Much thanks goes to the management
|
99
|
+
at Clarity Services Inc. for allowing this code to be open sourced. Thanks
|
100
|
+
also to Larry Berland at Clarity Services Inc. The matching logic in the
|
101
|
+
ofac_match.rb file was derived from his work.</p>
|
102
|
+
|
103
|
+
<h2 id="label-FEATURES%3A">FEATURES:</h2>
|
104
|
+
|
105
|
+
<p>Creates a score, 1 - 100, based on how well the name, address and city
|
106
|
+
match the data on the SDN list. Since we have to match on strings, the
|
107
|
+
likely hood of an exact match are virtually nil. So we’ve created an
|
108
|
+
algorithm that creates a score. The better the match, the higher the
|
109
|
+
score. A score of 100 would be a perfect match.</p>
|
110
|
+
|
111
|
+
<p>The score is calculated by adding up the weightings of each part that is
|
112
|
+
matched. So if only name is matched, then the max score is the weight for
|
113
|
+
<code>:name</code> which is 60</p>
|
114
|
+
|
115
|
+
<p>It’s possible to get partial matches, which will add partial weight to
|
116
|
+
the score. If there is not a match on the element as it is passed in, then
|
117
|
+
each word element gets broken down and matches are tried on each partial
|
118
|
+
element. The weighting is distrubuted equally for each partial that is
|
119
|
+
matched.</p>
|
120
|
+
|
121
|
+
<p>If exact matches are not made, then a sounds like match is attempted. Any
|
122
|
+
match made by sounds like is given 75% of it’s weight to the score.
|
123
|
+
Example:</p>
|
124
|
+
|
125
|
+
<p>If you are trying to match the name Kevin Tyll and there is a record for
|
126
|
+
Smith, Kevin in the database, then we will try to match both Kevin and Tyll
|
127
|
+
separately, with each element Smith and Kevin. Since only Kevin will find
|
128
|
+
a match, and there were 2 elements in the searched name, the score will be
|
129
|
+
added by half the weighting for <code>:name</code>. So since the weight
|
130
|
+
for <code>:name</code> is 60, then we will add 30 to the score.</p>
|
131
|
+
|
132
|
+
<p>If you are trying to match the name Kevin Gregory Tyll and there is a
|
133
|
+
record for Tyll, Kevin in the database, then we will try to match Kevin and
|
134
|
+
Gregory and Tyll separately, with each element Tyll and Kevin. Since both
|
135
|
+
Kevin and Tyll will find a match, and there were 3 elements in the searched
|
136
|
+
name, the score will be added by 2/3 the weighting for <code>:name</code>.
|
137
|
+
So since the weight for <code>:name</code> is 60, then we will add 40 to
|
138
|
+
the score.</p>
|
139
|
+
|
140
|
+
<p>If you are trying to match the name Kevin Tyll and there is a record for
|
141
|
+
Kevin Gregory Tyll in the database, then we will try to match Kevin and
|
142
|
+
Tyll separately, with each element Tyll and Kevin and Gregory. Since both
|
143
|
+
Kevin and Tyll will find a match, and there were 2 elements in the searched
|
144
|
+
name, the score will be added by 2/2 the weighting for <code>:name</code>.
|
145
|
+
So since the weight for <code>:name</code> is 60, then we will add 60 to
|
146
|
+
the score.</p>
|
147
|
+
|
148
|
+
<p>If you are trying to match the name Kevin Tyll, and there is a record for
|
149
|
+
Teel, Kevin in the database, then an exact match will be found for Kevin,
|
150
|
+
and a sounds like match will be made for Tyll. Since there were 2 elements
|
151
|
+
in the searched name, and the weight for <code>:name</code> is 60, then
|
152
|
+
each element is worth 30. Since Kevin was an exact match, it will add 30,
|
153
|
+
and since Tyll was a sounds like match, it will add 30 * .75. So the
|
154
|
+
<code>:name</code> portion of the search will be worth 53.</p>
|
155
|
+
|
156
|
+
<p>If data is in the database for city and or address, and you pass data in
|
157
|
+
for these elements, the score will be reduced by 10% of the weight if there
|
158
|
+
is no match or sounds like match. So if you get a match on name, you’ve
|
159
|
+
already got a score of 60. So if you don’t pass in an address or city,
|
160
|
+
or if you do, but there is no city or address info in the database, then
|
161
|
+
your final score will be 60. But if you do pass in a city, say Tampa, and
|
162
|
+
the city in the Database is New York, then we will deduct 10% of the weight
|
163
|
+
(30 * .1) = 3 from the score since 30 is the weight for <code>:city</code>.
|
164
|
+
So the final score will be 57.</p>
|
165
|
+
|
166
|
+
<p>If were searching for New York, and the database had New Deli, then there
|
167
|
+
would be a match on New, but not on Deli. Since there were 2 elements in
|
168
|
+
the searched city, each hit is worth 15. So the match on New would add 15,
|
169
|
+
but the non-match on York would subtract (15 * .1) = 1.5 from the score.
|
170
|
+
So the score would be (60 + 15 - 1.5) = 74, due to rounding.</p>
|
171
|
+
|
172
|
+
<p>Only <code>:city</code> and <code>:address</code> subtract from the score,
|
173
|
+
No match on name simply returns 0.</p>
|
174
|
+
|
175
|
+
<p>Matches for name are made for both the name and any aliases in the OFAC
|
176
|
+
database.</p>
|
177
|
+
|
178
|
+
<p>Matches for <code>:city</code> and <code>:address</code> will only be added
|
179
|
+
to the score if there is first a match on <code>:name</code>.</p>
|
180
|
+
|
181
|
+
<p>We consider a score of 60 to be reasonable as a hit.</p>
|
182
|
+
|
183
|
+
<h2 id="label-SYNOPSIS%3A">SYNOPSIS:</h2>
|
184
|
+
|
185
|
+
<p>Accepts a hash with the identity’s demographic information</p>
|
186
|
+
|
187
|
+
<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">></span> <span class="ruby-string">'Oscar Hernandez'</span>, :<span class="ruby-identifier">city</span> =<span class="ruby-operator">></span> <span class="ruby-string">'Clearwater'</span>, :<span class="ruby-identifier">address</span> =<span class="ruby-operator">></span> <span class="ruby-string">'123 somewhere ln'</span>})
|
188
|
+
</pre>
|
189
|
+
|
190
|
+
<p><code>:name</code> is required to get a score. If <code>:name</code> is
|
191
|
+
missing, an error will not be thrown, but a score of 0 will be returned.</p>
|
192
|
+
|
193
|
+
<p>The more information provided, the higher the score could be. A score of
|
194
|
+
100 would mean all fields were passed in, and all fields were 100% matches.
|
195
|
+
If only the name is passed in without an address, it will be impossible to
|
196
|
+
get a score of 100, even if the name matches perfectly.</p>
|
197
|
+
|
198
|
+
<p>Acceptable hash keys and their weighting in score calculation:</p>
|
199
|
+
<ul><li>
|
200
|
+
<p><code>:name</code> (weighting = 60%) (required) This can be a person,
|
201
|
+
business, or marine vessel</p>
|
202
|
+
</li><li>
|
203
|
+
<p><code>:address</code> (weighting = 10%)</p>
|
204
|
+
</li><li>
|
205
|
+
<p><code>:city</code> (weighting = 30%)</p>
|
206
|
+
</li><li>
|
207
|
+
<p>Instantiate the object with the identity’s name, street address, and
|
208
|
+
city.</p>
|
209
|
+
|
210
|
+
<pre class="ruby"><span class="ruby-identifier">ofac</span> = <span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">></span> <span class="ruby-string">'Kevin Tyll'</span>, :<span class="ruby-identifier">city</span> =<span class="ruby-operator">></span> <span class="ruby-string">'Clearwater'</span>, :<span class="ruby-identifier">address</span> =<span class="ruby-operator">></span> <span class="ruby-string">'123 Somewhere Ln.'</span>)
|
211
|
+
</pre>
|
212
|
+
</li><li>
|
213
|
+
<p>Then get the score</p>
|
214
|
+
|
215
|
+
<pre class="ruby"><span class="ruby-identifier">ofac</span>.<span class="ruby-identifier">score</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">score</span> <span class="ruby-value">1</span> <span class="ruby-operator">-</span> <span class="ruby-value">100</span>
|
216
|
+
</pre>
|
217
|
+
</li><li>
|
218
|
+
<p>You can also get the list of all the partial matches with the score of each
|
219
|
+
record.</p>
|
220
|
+
|
221
|
+
<pre class="ruby"><span class="ruby-identifier">ofac</span>.<span class="ruby-identifier">possible_hits</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">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>.
|
222
|
+
</pre>
|
223
|
+
</li></ul>
|
224
|
+
|
225
|
+
<h2 id="label-REQUIREMENTS%3A">REQUIREMENTS:</h2>
|
226
|
+
<ul><li>
|
227
|
+
<p>Rails 2.0.0 or greater</p>
|
228
|
+
</li></ul>
|
229
|
+
|
230
|
+
<h2 id="label-INSTALL%3A">INSTALL:</h2>
|
231
|
+
<ul><li>
|
232
|
+
<p>To install the gem:</p>
|
233
|
+
|
234
|
+
<pre>sudo gem install kevintyll-ofac</pre>
|
235
|
+
</li><li>
|
236
|
+
<p>To create the necessary db migration, from the command line, run:</p>
|
237
|
+
|
238
|
+
<pre>script/generate ofac_migration</pre>
|
239
|
+
</li><li>
|
240
|
+
<p>Require the gem in your environment.rb file in the Rails::Initializer
|
241
|
+
block:</p>
|
242
|
+
|
243
|
+
<pre class="ruby"><span class="ruby-identifier">config</span>.<span class="ruby-identifier">gem</span> <span class="ruby-string">'kevintyll-ofac'</span>, :<span class="ruby-identifier">lib</span> =<span class="ruby-operator">></span> <span class="ruby-string">'ofac'</span>
|
244
|
+
</pre>
|
245
|
+
</li><li>
|
246
|
+
<p>To load your table with the current OFAC data, from the command line, run:</p>
|
247
|
+
|
248
|
+
<pre>rake ofac:update_data
|
249
|
+
|
250
|
+
* The OFAC data is not updated with any regularity, but you can sign up for email notifications when the data changes at
|
251
|
+
http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml.</pre>
|
252
|
+
</li></ul>
|
253
|
+
|
254
|
+
<h2 id="label-Copyright">Copyright</h2>
|
255
|
+
|
256
|
+
<p>Copyright © 2009 Kevin Tyll. See LICENSE for details.</p>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<footer id="validator-badges">
|
263
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
264
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
265
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
266
|
+
</footer>
|
267
|
+
|
data/rdoc/String.html
ADDED
@@ -0,0 +1,245 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Class: String</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
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/ofac/ruby_string_extensions.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-i-ofac_soundex">#ofac_soundex</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-ofac_sounds_like">#ofac_sounds_like</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</nav>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div id="project-metadata">
|
83
|
+
<nav id="fileindex-section" class="section project-section">
|
84
|
+
<h3 class="section-header">Pages</h3>
|
85
|
+
|
86
|
+
<ul>
|
87
|
+
|
88
|
+
<li class="file"><a href="./README_rdoc.html">README</a>
|
89
|
+
|
90
|
+
</ul>
|
91
|
+
</nav>
|
92
|
+
|
93
|
+
<nav id="classindex-section" class="section project-section">
|
94
|
+
<h3 class="section-header">Class and Module Index</h3>
|
95
|
+
|
96
|
+
<ul class="link-list">
|
97
|
+
|
98
|
+
<li><a href="./Ofac.html">Ofac</a>
|
99
|
+
|
100
|
+
<li><a href="./OfacMatch.html">OfacMatch</a>
|
101
|
+
|
102
|
+
<li><a href="./OfacSdn.html">OfacSdn</a>
|
103
|
+
|
104
|
+
<li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
|
105
|
+
|
106
|
+
<li><a href="./String.html">String</a>
|
107
|
+
|
108
|
+
</ul>
|
109
|
+
</nav>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</nav>
|
113
|
+
|
114
|
+
<div id="documentation">
|
115
|
+
<h1 class="class">class String</h1>
|
116
|
+
|
117
|
+
<div id="description" class="description">
|
118
|
+
|
119
|
+
</div><!-- description -->
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<!-- Constants -->
|
131
|
+
<section id="constants-list" class="section">
|
132
|
+
<h3 class="section-header">Constants</h3>
|
133
|
+
<dl>
|
134
|
+
|
135
|
+
<dt id="Ofac_SoundexChars">Ofac_SoundexChars
|
136
|
+
|
137
|
+
<dd class="description">
|
138
|
+
|
139
|
+
|
140
|
+
<dt id="Ofac_SoundexCharsDel">Ofac_SoundexCharsDel
|
141
|
+
|
142
|
+
<dd class="description">
|
143
|
+
|
144
|
+
|
145
|
+
<dt id="Ofac_SoundexCharsEx">Ofac_SoundexCharsEx
|
146
|
+
|
147
|
+
<dd class="description">
|
148
|
+
|
149
|
+
|
150
|
+
<dt id="Ofac_SoundexNums">Ofac_SoundexNums
|
151
|
+
|
152
|
+
<dd class="description">
|
153
|
+
|
154
|
+
|
155
|
+
</dl>
|
156
|
+
</section>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<!-- Methods -->
|
162
|
+
|
163
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
164
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
165
|
+
|
166
|
+
|
167
|
+
<div id="method-i-ofac_soundex" class="method-detail ">
|
168
|
+
|
169
|
+
<div class="method-heading">
|
170
|
+
<span class="method-name">ofac_soundex</span><span
|
171
|
+
class="method-args">(census = true)</span>
|
172
|
+
<span class="method-click-advice">click to toggle source</span>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
|
178
|
+
<p>desc: <a
|
179
|
+
href="http://en.wikipedia.org/wiki/Soundex">en.wikipedia.org/wiki/Soundex</a></p>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method-source-code" id="ofac_soundex-source">
|
184
|
+
<pre><span class="ruby-comment"># File lib/ofac/ruby_string_extensions.rb, line 9</span>
|
185
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span> = <span class="ruby-keyword">true</span>)
|
186
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">upcase</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">Ofac_SoundexCharsDel</span>).<span class="ruby-identifier">squeeze</span>
|
187
|
+
|
188
|
+
<span class="ruby-identifier">str</span>[<span class="ruby-value">0</span> <span class="ruby-operator">..</span> <span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">str</span>[<span class="ruby-value">1</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].
|
189
|
+
<span class="ruby-identifier">delete</span>(<span class="ruby-constant">Ofac_SoundexCharsEx</span>).
|
190
|
+
<span class="ruby-identifier">tr</span>(<span class="ruby-constant">Ofac_SoundexChars</span>, <span class="ruby-constant">Ofac_SoundexNums</span>)[<span class="ruby-value">0</span> <span class="ruby-operator">..</span> (<span class="ruby-identifier">census</span> <span class="ruby-operator">?</span> <span class="ruby-value">2</span> <span class="ruby-operator">:</span> <span class="ruby-value">-1</span>)].
|
191
|
+
<span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-string">'0'</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-string">''</span>
|
192
|
+
<span class="ruby-keyword">end</span></pre>
|
193
|
+
</div><!-- ofac_soundex-source -->
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
</div><!-- ofac_soundex-method -->
|
201
|
+
|
202
|
+
|
203
|
+
<div id="method-i-ofac_sounds_like" class="method-detail ">
|
204
|
+
|
205
|
+
<div class="method-heading">
|
206
|
+
<span class="method-name">ofac_sounds_like</span><span
|
207
|
+
class="method-args">(other, census = true)</span>
|
208
|
+
<span class="method-click-advice">click to toggle source</span>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<div class="method-source-code" id="ofac_sounds_like-source">
|
219
|
+
<pre><span class="ruby-comment"># File lib/ofac/ruby_string_extensions.rb, line 18</span>
|
220
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ofac_sounds_like</span>(<span class="ruby-identifier">other</span>, <span class="ruby-identifier">census</span> = <span class="ruby-keyword">true</span>)
|
221
|
+
<span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span>)
|
222
|
+
<span class="ruby-keyword">end</span></pre>
|
223
|
+
</div><!-- ofac_sounds_like-source -->
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</div><!-- ofac_sounds_like-method -->
|
231
|
+
|
232
|
+
|
233
|
+
</section><!-- public-instance-method-details -->
|
234
|
+
|
235
|
+
</section><!-- 5Buntitled-5D -->
|
236
|
+
|
237
|
+
</div><!-- documentation -->
|
238
|
+
|
239
|
+
|
240
|
+
<footer id="validator-badges">
|
241
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
242
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
243
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
244
|
+
</footer>
|
245
|
+
|