flatulent 0.0.3 → 0.0.4
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.
- data/flatulent-0.0.4.gem +0 -0
- data/install.rb +210 -0
- data/lib/flatulent.rb +76 -61
- data/rails/app/controllers/flatulent_controller.rb +6 -4
- data/rails/log/development.log +7242 -0
- data/rails/tmp/sessions/ruby_sess.82080df62364f531 +0 -0
- data/rails/tmp/sessions/ruby_sess.8900d08ad306f253 +0 -0
- data/rails/tmp/sessions/ruby_sess.f8fa47c3571d2497 +0 -0
- metadata +7 -49
- data/flatulent-0.0.2.gem +0 -0
- data/rails/lib/flatulent.rb +0 -450
- data/rails/lib/flatulent/attributes.rb +0 -79
- data/rails/lib/flatulent/crypt/blowfish-tables.rb +0 -190
- data/rails/lib/flatulent/crypt/blowfish.rb +0 -109
- data/rails/lib/flatulent/crypt/cbc.rb +0 -123
- data/rails/lib/flatulent/crypt/gost.rb +0 -140
- data/rails/lib/flatulent/crypt/idea.rb +0 -193
- data/rails/lib/flatulent/crypt/noise.rb +0 -94
- data/rails/lib/flatulent/crypt/purerubystringio.rb +0 -378
- data/rails/lib/flatulent/crypt/rijndael-tables.rb +0 -117
- data/rails/lib/flatulent/crypt/rijndael.rb +0 -269
- data/rails/lib/flatulent/fontfiles/banner.flf +0 -2494
- data/rails/lib/flatulent/fontfiles/big.flf +0 -2204
- data/rails/lib/flatulent/fontfiles/block.flf +0 -1691
- data/rails/lib/flatulent/fontfiles/bubble.flf +0 -1630
- data/rails/lib/flatulent/fontfiles/digital.flf +0 -1286
- data/rails/lib/flatulent/fontfiles/ivrit.flf +0 -900
- data/rails/lib/flatulent/fontfiles/lean.flf +0 -1691
- data/rails/lib/flatulent/fontfiles/mini.flf +0 -899
- data/rails/lib/flatulent/fontfiles/mnemonic.flf +0 -3702
- data/rails/lib/flatulent/fontfiles/script.flf +0 -1493
- data/rails/lib/flatulent/fontfiles/shadow.flf +0 -1097
- data/rails/lib/flatulent/fontfiles/slant.flf +0 -1295
- data/rails/lib/flatulent/fontfiles/small.flf +0 -1097
- data/rails/lib/flatulent/fontfiles/smscript.flf +0 -1097
- data/rails/lib/flatulent/fontfiles/smshadow.flf +0 -899
- data/rails/lib/flatulent/fontfiles/smslant.flf +0 -1097
- data/rails/lib/flatulent/fontfiles/standard.flf +0 -2227
- data/rails/lib/flatulent/fontfiles/term.flf +0 -600
- data/rails/lib/flatulent/pervasives.rb +0 -32
- data/rails/lib/flatulent/stringxor.rb +0 -27
- data/rails/lib/flatulent/text.rb +0 -6
- data/rails/lib/flatulent/text/double_metaphone.rb +0 -356
- data/rails/lib/flatulent/text/figlet.rb +0 -17
- data/rails/lib/flatulent/text/figlet/font.rb +0 -117
- data/rails/lib/flatulent/text/figlet/smusher.rb +0 -64
- data/rails/lib/flatulent/text/figlet/typesetter.rb +0 -68
- data/rails/lib/flatulent/text/levenshtein.rb +0 -65
- data/rails/lib/flatulent/text/metaphone.rb +0 -97
- data/rails/lib/flatulent/text/porter_stemming.rb +0 -171
- data/rails/lib/flatulent/text/soundex.rb +0 -61
@@ -1,61 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Ruby implementation of the Soundex algorithm,
|
3
|
-
# as described by Knuth in volume 3 of The Art of Computer Programming.
|
4
|
-
#
|
5
|
-
# Author: Michael Neumann (neumann@s-direktnet.de)
|
6
|
-
#
|
7
|
-
|
8
|
-
module Text # :nodoc:
|
9
|
-
module Soundex
|
10
|
-
|
11
|
-
def soundex(str_or_arr)
|
12
|
-
case str_or_arr
|
13
|
-
when String
|
14
|
-
soundex_str(str_or_arr)
|
15
|
-
when Array
|
16
|
-
str_or_arr.collect{|ele| soundex_str(ele)}
|
17
|
-
else
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
end
|
21
|
-
module_function :soundex
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
#
|
26
|
-
# returns nil if the value couldn't be calculated (empty-string, wrong-character)
|
27
|
-
# do not change the parameter "str"
|
28
|
-
#
|
29
|
-
def soundex_str(str)
|
30
|
-
return nil if str.empty?
|
31
|
-
|
32
|
-
str = str.upcase
|
33
|
-
last_code = get_code(str[0,1])
|
34
|
-
soundex_code = str[0,1]
|
35
|
-
|
36
|
-
for index in 1...(str.size) do
|
37
|
-
return soundex_code if soundex_code.size == 4
|
38
|
-
|
39
|
-
code = get_code(str[index,1])
|
40
|
-
|
41
|
-
if code == "0" then
|
42
|
-
last_code = nil
|
43
|
-
elsif code == nil then
|
44
|
-
return nil
|
45
|
-
elsif code != last_code then
|
46
|
-
soundex_code += code
|
47
|
-
last_code = code
|
48
|
-
end
|
49
|
-
end # for
|
50
|
-
|
51
|
-
return soundex_code + "000"[0,4-soundex_code.size]
|
52
|
-
end
|
53
|
-
module_function :soundex_str
|
54
|
-
|
55
|
-
def get_code(char)
|
56
|
-
char.tr! "AEIOUYWHBPFVCSKGJQXZDTLMNR", "00000000111122222222334556"
|
57
|
-
end
|
58
|
-
module_function :get_code
|
59
|
-
|
60
|
-
end # module Soundex
|
61
|
-
end # module Text
|