stringex 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +184 -184
- data/lib/stringex/acts_as_url.rb +107 -0
- data/lib/stringex/string_extensions.rb +198 -0
- data/lib/stringex/unidecoder.rb +159 -0
- data/lib/stringex/unidecoder_data/x00.yml +257 -0
- data/lib/stringex/unidecoder_data/x01.yml +257 -0
- data/lib/stringex/unidecoder_data/x02.yml +256 -0
- data/lib/stringex/unidecoder_data/x03.yml +256 -0
- data/lib/stringex/unidecoder_data/x04.yml +256 -0
- data/lib/stringex/unidecoder_data/x05.yml +256 -0
- data/lib/stringex/unidecoder_data/x06.yml +256 -0
- data/lib/stringex/unidecoder_data/x07.yml +256 -0
- data/lib/stringex/unidecoder_data/x09.yml +256 -0
- data/lib/stringex/unidecoder_data/x0a.yml +256 -0
- data/lib/stringex/unidecoder_data/x0b.yml +256 -0
- data/lib/stringex/unidecoder_data/x0c.yml +256 -0
- data/lib/stringex/unidecoder_data/x0d.yml +256 -0
- data/lib/stringex/unidecoder_data/x0e.yml +256 -0
- data/lib/stringex/unidecoder_data/x0f.yml +256 -0
- data/lib/stringex/unidecoder_data/x10.yml +256 -0
- data/lib/stringex/unidecoder_data/x11.yml +256 -0
- data/lib/stringex/unidecoder_data/x12.yml +257 -0
- data/lib/stringex/unidecoder_data/x13.yml +256 -0
- data/lib/stringex/unidecoder_data/x14.yml +257 -0
- data/lib/stringex/unidecoder_data/x15.yml +257 -0
- data/lib/stringex/unidecoder_data/x16.yml +256 -0
- data/lib/stringex/unidecoder_data/x17.yml +256 -0
- data/lib/stringex/unidecoder_data/x18.yml +256 -0
- data/lib/stringex/unidecoder_data/x1e.yml +256 -0
- data/lib/stringex/unidecoder_data/x1f.yml +256 -0
- data/lib/stringex/unidecoder_data/x20.yml +256 -0
- data/lib/stringex/unidecoder_data/x21.yml +256 -0
- data/lib/stringex/unidecoder_data/x22.yml +256 -0
- data/lib/stringex/unidecoder_data/x23.yml +256 -0
- data/lib/stringex/unidecoder_data/x24.yml +256 -0
- data/lib/stringex/unidecoder_data/x25.yml +256 -0
- data/lib/stringex/unidecoder_data/x26.yml +256 -0
- data/lib/stringex/unidecoder_data/x27.yml +256 -0
- data/lib/stringex/unidecoder_data/x28.yml +257 -0
- data/lib/stringex/unidecoder_data/x2e.yml +256 -0
- data/lib/stringex/unidecoder_data/x2f.yml +256 -0
- data/lib/stringex/unidecoder_data/x30.yml +256 -0
- data/lib/stringex/unidecoder_data/x31.yml +256 -0
- data/lib/stringex/unidecoder_data/x32.yml +256 -0
- data/lib/stringex/unidecoder_data/x33.yml +256 -0
- data/lib/stringex/unidecoder_data/x4d.yml +256 -0
- data/lib/stringex/unidecoder_data/x4e.yml +257 -0
- data/lib/stringex/unidecoder_data/x4f.yml +257 -0
- data/lib/stringex/unidecoder_data/x50.yml +257 -0
- data/lib/stringex/unidecoder_data/x51.yml +257 -0
- data/lib/stringex/unidecoder_data/x52.yml +257 -0
- data/lib/stringex/unidecoder_data/x53.yml +257 -0
- data/lib/stringex/unidecoder_data/x54.yml +257 -0
- data/lib/stringex/unidecoder_data/x55.yml +257 -0
- data/lib/stringex/unidecoder_data/x56.yml +257 -0
- data/lib/stringex/unidecoder_data/x57.yml +257 -0
- data/lib/stringex/unidecoder_data/x58.yml +257 -0
- data/lib/stringex/unidecoder_data/x59.yml +257 -0
- data/lib/stringex/unidecoder_data/x5a.yml +257 -0
- data/lib/stringex/unidecoder_data/x5b.yml +257 -0
- data/lib/stringex/unidecoder_data/x5c.yml +257 -0
- data/lib/stringex/unidecoder_data/x5d.yml +257 -0
- data/lib/stringex/unidecoder_data/x5e.yml +257 -0
- data/lib/stringex/unidecoder_data/x5f.yml +257 -0
- data/lib/stringex/unidecoder_data/x60.yml +257 -0
- data/lib/stringex/unidecoder_data/x61.yml +257 -0
- data/lib/stringex/unidecoder_data/x62.yml +257 -0
- data/lib/stringex/unidecoder_data/x63.yml +257 -0
- data/lib/stringex/unidecoder_data/x64.yml +257 -0
- data/lib/stringex/unidecoder_data/x65.yml +257 -0
- data/lib/stringex/unidecoder_data/x66.yml +257 -0
- data/lib/stringex/unidecoder_data/x67.yml +257 -0
- data/lib/stringex/unidecoder_data/x68.yml +257 -0
- data/lib/stringex/unidecoder_data/x69.yml +257 -0
- data/lib/stringex/unidecoder_data/x6a.yml +257 -0
- data/lib/stringex/unidecoder_data/x6b.yml +257 -0
- data/lib/stringex/unidecoder_data/x6c.yml +257 -0
- data/lib/stringex/unidecoder_data/x6d.yml +257 -0
- data/lib/stringex/unidecoder_data/x6e.yml +257 -0
- data/lib/stringex/unidecoder_data/x6f.yml +257 -0
- data/lib/stringex/unidecoder_data/x70.yml +257 -0
- data/lib/stringex/unidecoder_data/x71.yml +257 -0
- data/lib/stringex/unidecoder_data/x72.yml +257 -0
- data/lib/stringex/unidecoder_data/x73.yml +257 -0
- data/lib/stringex/unidecoder_data/x74.yml +257 -0
- data/lib/stringex/unidecoder_data/x75.yml +257 -0
- data/lib/stringex/unidecoder_data/x76.yml +257 -0
- data/lib/stringex/unidecoder_data/x77.yml +257 -0
- data/lib/stringex/unidecoder_data/x78.yml +257 -0
- data/lib/stringex/unidecoder_data/x79.yml +257 -0
- data/lib/stringex/unidecoder_data/x7a.yml +257 -0
- data/lib/stringex/unidecoder_data/x7b.yml +257 -0
- data/lib/stringex/unidecoder_data/x7c.yml +257 -0
- data/lib/stringex/unidecoder_data/x7d.yml +257 -0
- data/lib/stringex/unidecoder_data/x7e.yml +257 -0
- data/lib/stringex/unidecoder_data/x7f.yml +257 -0
- data/lib/stringex/unidecoder_data/x80.yml +257 -0
- data/lib/stringex/unidecoder_data/x81.yml +257 -0
- data/lib/stringex/unidecoder_data/x82.yml +257 -0
- data/lib/stringex/unidecoder_data/x83.yml +257 -0
- data/lib/stringex/unidecoder_data/x84.yml +257 -0
- data/lib/stringex/unidecoder_data/x85.yml +257 -0
- data/lib/stringex/unidecoder_data/x86.yml +257 -0
- data/lib/stringex/unidecoder_data/x87.yml +257 -0
- data/lib/stringex/unidecoder_data/x88.yml +257 -0
- data/lib/stringex/unidecoder_data/x89.yml +257 -0
- data/lib/stringex/unidecoder_data/x8a.yml +257 -0
- data/lib/stringex/unidecoder_data/x8b.yml +257 -0
- data/lib/stringex/unidecoder_data/x8c.yml +257 -0
- data/lib/stringex/unidecoder_data/x8d.yml +257 -0
- data/lib/stringex/unidecoder_data/x8e.yml +257 -0
- data/lib/stringex/unidecoder_data/x8f.yml +257 -0
- data/lib/stringex/unidecoder_data/x90.yml +257 -0
- data/lib/stringex/unidecoder_data/x91.yml +257 -0
- data/lib/stringex/unidecoder_data/x92.yml +257 -0
- data/lib/stringex/unidecoder_data/x93.yml +257 -0
- data/lib/stringex/unidecoder_data/x94.yml +257 -0
- data/lib/stringex/unidecoder_data/x95.yml +257 -0
- data/lib/stringex/unidecoder_data/x96.yml +257 -0
- data/lib/stringex/unidecoder_data/x97.yml +257 -0
- data/lib/stringex/unidecoder_data/x98.yml +257 -0
- data/lib/stringex/unidecoder_data/x99.yml +257 -0
- data/lib/stringex/unidecoder_data/x9a.yml +257 -0
- data/lib/stringex/unidecoder_data/x9b.yml +257 -0
- data/lib/stringex/unidecoder_data/x9c.yml +257 -0
- data/lib/stringex/unidecoder_data/x9d.yml +257 -0
- data/lib/stringex/unidecoder_data/x9e.yml +257 -0
- data/lib/stringex/unidecoder_data/x9f.yml +256 -0
- data/lib/stringex/unidecoder_data/xa0.yml +257 -0
- data/lib/stringex/unidecoder_data/xa1.yml +257 -0
- data/lib/stringex/unidecoder_data/xa2.yml +257 -0
- data/lib/stringex/unidecoder_data/xa3.yml +257 -0
- data/lib/stringex/unidecoder_data/xa4.yml +256 -0
- data/lib/stringex/unidecoder_data/xac.yml +257 -0
- data/lib/stringex/unidecoder_data/xad.yml +257 -0
- data/lib/stringex/unidecoder_data/xae.yml +257 -0
- data/lib/stringex/unidecoder_data/xaf.yml +257 -0
- data/lib/stringex/unidecoder_data/xb0.yml +257 -0
- data/lib/stringex/unidecoder_data/xb1.yml +257 -0
- data/lib/stringex/unidecoder_data/xb2.yml +257 -0
- data/lib/stringex/unidecoder_data/xb3.yml +257 -0
- data/lib/stringex/unidecoder_data/xb4.yml +257 -0
- data/lib/stringex/unidecoder_data/xb5.yml +257 -0
- data/lib/stringex/unidecoder_data/xb6.yml +257 -0
- data/lib/stringex/unidecoder_data/xb7.yml +257 -0
- data/lib/stringex/unidecoder_data/xb8.yml +257 -0
- data/lib/stringex/unidecoder_data/xb9.yml +257 -0
- data/lib/stringex/unidecoder_data/xba.yml +257 -0
- data/lib/stringex/unidecoder_data/xbb.yml +257 -0
- data/lib/stringex/unidecoder_data/xbc.yml +257 -0
- data/lib/stringex/unidecoder_data/xbd.yml +257 -0
- data/lib/stringex/unidecoder_data/xbe.yml +257 -0
- data/lib/stringex/unidecoder_data/xbf.yml +257 -0
- data/lib/stringex/unidecoder_data/xc0.yml +257 -0
- data/lib/stringex/unidecoder_data/xc1.yml +257 -0
- data/lib/stringex/unidecoder_data/xc2.yml +257 -0
- data/lib/stringex/unidecoder_data/xc3.yml +257 -0
- data/lib/stringex/unidecoder_data/xc4.yml +257 -0
- data/lib/stringex/unidecoder_data/xc5.yml +257 -0
- data/lib/stringex/unidecoder_data/xc6.yml +257 -0
- data/lib/stringex/unidecoder_data/xc7.yml +257 -0
- data/lib/stringex/unidecoder_data/xc8.yml +257 -0
- data/lib/stringex/unidecoder_data/xc9.yml +257 -0
- data/lib/stringex/unidecoder_data/xca.yml +257 -0
- data/lib/stringex/unidecoder_data/xcb.yml +257 -0
- data/lib/stringex/unidecoder_data/xcc.yml +257 -0
- data/lib/stringex/unidecoder_data/xcd.yml +257 -0
- data/lib/stringex/unidecoder_data/xce.yml +257 -0
- data/lib/stringex/unidecoder_data/xcf.yml +257 -0
- data/lib/stringex/unidecoder_data/xd0.yml +257 -0
- data/lib/stringex/unidecoder_data/xd1.yml +257 -0
- data/lib/stringex/unidecoder_data/xd2.yml +257 -0
- data/lib/stringex/unidecoder_data/xd3.yml +257 -0
- data/lib/stringex/unidecoder_data/xd4.yml +257 -0
- data/lib/stringex/unidecoder_data/xd5.yml +257 -0
- data/lib/stringex/unidecoder_data/xd6.yml +257 -0
- data/lib/stringex/unidecoder_data/xd7.yml +256 -0
- data/lib/stringex/unidecoder_data/xf9.yml +257 -0
- data/lib/stringex/unidecoder_data/xfa.yml +256 -0
- data/lib/stringex/unidecoder_data/xfb.yml +257 -0
- data/lib/stringex/unidecoder_data/xfc.yml +257 -0
- data/lib/stringex/unidecoder_data/xfd.yml +256 -0
- data/lib/stringex/unidecoder_data/xfe.yml +257 -0
- data/lib/stringex/unidecoder_data/xff.yml +257 -0
- data/stringex.gemspec +184 -1
- metadata +186 -3
data/Rakefile
CHANGED
@@ -21,189 +21,189 @@ begin
|
|
21
21
|
README.rdoc
|
22
22
|
stringex.gemspec
|
23
23
|
lib/stringex.rb
|
24
|
-
lib/
|
25
|
-
lib/
|
26
|
-
lib/
|
27
|
-
lib/
|
28
|
-
lib/
|
29
|
-
lib/
|
30
|
-
lib/
|
31
|
-
lib/
|
32
|
-
lib/
|
33
|
-
lib/
|
34
|
-
lib/
|
35
|
-
lib/
|
36
|
-
lib/
|
37
|
-
lib/
|
38
|
-
lib/
|
39
|
-
lib/
|
40
|
-
lib/
|
41
|
-
lib/
|
42
|
-
lib/
|
43
|
-
lib/
|
44
|
-
lib/
|
45
|
-
lib/
|
46
|
-
lib/
|
47
|
-
lib/
|
48
|
-
lib/
|
49
|
-
lib/
|
50
|
-
lib/
|
51
|
-
lib/
|
52
|
-
lib/
|
53
|
-
lib/
|
54
|
-
lib/
|
55
|
-
lib/
|
56
|
-
lib/
|
57
|
-
lib/
|
58
|
-
lib/
|
59
|
-
lib/
|
60
|
-
lib/
|
61
|
-
lib/
|
62
|
-
lib/
|
63
|
-
lib/
|
64
|
-
lib/
|
65
|
-
lib/
|
66
|
-
lib/
|
67
|
-
lib/
|
68
|
-
lib/
|
69
|
-
lib/
|
70
|
-
lib/
|
71
|
-
lib/
|
72
|
-
lib/
|
73
|
-
lib/
|
74
|
-
lib/
|
75
|
-
lib/
|
76
|
-
lib/
|
77
|
-
lib/
|
78
|
-
lib/
|
79
|
-
lib/
|
80
|
-
lib/
|
81
|
-
lib/
|
82
|
-
lib/
|
83
|
-
lib/
|
84
|
-
lib/
|
85
|
-
lib/
|
86
|
-
lib/
|
87
|
-
lib/
|
88
|
-
lib/
|
89
|
-
lib/
|
90
|
-
lib/
|
91
|
-
lib/
|
92
|
-
lib/
|
93
|
-
lib/
|
94
|
-
lib/
|
95
|
-
lib/
|
96
|
-
lib/
|
97
|
-
lib/
|
98
|
-
lib/
|
99
|
-
lib/
|
100
|
-
lib/
|
101
|
-
lib/
|
102
|
-
lib/
|
103
|
-
lib/
|
104
|
-
lib/
|
105
|
-
lib/
|
106
|
-
lib/
|
107
|
-
lib/
|
108
|
-
lib/
|
109
|
-
lib/
|
110
|
-
lib/
|
111
|
-
lib/
|
112
|
-
lib/
|
113
|
-
lib/
|
114
|
-
lib/
|
115
|
-
lib/
|
116
|
-
lib/
|
117
|
-
lib/
|
118
|
-
lib/
|
119
|
-
lib/
|
120
|
-
lib/
|
121
|
-
lib/
|
122
|
-
lib/
|
123
|
-
lib/
|
124
|
-
lib/
|
125
|
-
lib/
|
126
|
-
lib/
|
127
|
-
lib/
|
128
|
-
lib/
|
129
|
-
lib/
|
130
|
-
lib/
|
131
|
-
lib/
|
132
|
-
lib/
|
133
|
-
lib/
|
134
|
-
lib/
|
135
|
-
lib/
|
136
|
-
lib/
|
137
|
-
lib/
|
138
|
-
lib/
|
139
|
-
lib/
|
140
|
-
lib/
|
141
|
-
lib/
|
142
|
-
lib/
|
143
|
-
lib/
|
144
|
-
lib/
|
145
|
-
lib/
|
146
|
-
lib/
|
147
|
-
lib/
|
148
|
-
lib/
|
149
|
-
lib/
|
150
|
-
lib/
|
151
|
-
lib/
|
152
|
-
lib/
|
153
|
-
lib/
|
154
|
-
lib/
|
155
|
-
lib/
|
156
|
-
lib/
|
157
|
-
lib/
|
158
|
-
lib/
|
159
|
-
lib/
|
160
|
-
lib/
|
161
|
-
lib/
|
162
|
-
lib/
|
163
|
-
lib/
|
164
|
-
lib/
|
165
|
-
lib/
|
166
|
-
lib/
|
167
|
-
lib/
|
168
|
-
lib/
|
169
|
-
lib/
|
170
|
-
lib/
|
171
|
-
lib/
|
172
|
-
lib/
|
173
|
-
lib/
|
174
|
-
lib/
|
175
|
-
lib/
|
176
|
-
lib/
|
177
|
-
lib/
|
178
|
-
lib/
|
179
|
-
lib/
|
180
|
-
lib/
|
181
|
-
lib/
|
182
|
-
lib/
|
183
|
-
lib/
|
184
|
-
lib/
|
185
|
-
lib/
|
186
|
-
lib/
|
187
|
-
lib/
|
188
|
-
lib/
|
189
|
-
lib/
|
190
|
-
lib/
|
191
|
-
lib/
|
192
|
-
lib/
|
193
|
-
lib/
|
194
|
-
lib/
|
195
|
-
lib/
|
196
|
-
lib/
|
197
|
-
lib/
|
198
|
-
lib/
|
199
|
-
lib/
|
200
|
-
lib/
|
201
|
-
lib/
|
202
|
-
lib/
|
203
|
-
lib/
|
204
|
-
lib/
|
205
|
-
lib/
|
206
|
-
lib/
|
24
|
+
lib/stringex/acts_as_url.rb
|
25
|
+
lib/stringex/string_extensions.rb
|
26
|
+
lib/stringex/unidecoder.rb
|
27
|
+
lib/stringex/unidecoder_data/x00.yml
|
28
|
+
lib/stringex/unidecoder_data/x01.yml
|
29
|
+
lib/stringex/unidecoder_data/x02.yml
|
30
|
+
lib/stringex/unidecoder_data/x03.yml
|
31
|
+
lib/stringex/unidecoder_data/x04.yml
|
32
|
+
lib/stringex/unidecoder_data/x05.yml
|
33
|
+
lib/stringex/unidecoder_data/x06.yml
|
34
|
+
lib/stringex/unidecoder_data/x07.yml
|
35
|
+
lib/stringex/unidecoder_data/x09.yml
|
36
|
+
lib/stringex/unidecoder_data/x0a.yml
|
37
|
+
lib/stringex/unidecoder_data/x0b.yml
|
38
|
+
lib/stringex/unidecoder_data/x0c.yml
|
39
|
+
lib/stringex/unidecoder_data/x0d.yml
|
40
|
+
lib/stringex/unidecoder_data/x0e.yml
|
41
|
+
lib/stringex/unidecoder_data/x0f.yml
|
42
|
+
lib/stringex/unidecoder_data/x10.yml
|
43
|
+
lib/stringex/unidecoder_data/x11.yml
|
44
|
+
lib/stringex/unidecoder_data/x12.yml
|
45
|
+
lib/stringex/unidecoder_data/x13.yml
|
46
|
+
lib/stringex/unidecoder_data/x14.yml
|
47
|
+
lib/stringex/unidecoder_data/x15.yml
|
48
|
+
lib/stringex/unidecoder_data/x16.yml
|
49
|
+
lib/stringex/unidecoder_data/x17.yml
|
50
|
+
lib/stringex/unidecoder_data/x18.yml
|
51
|
+
lib/stringex/unidecoder_data/x1e.yml
|
52
|
+
lib/stringex/unidecoder_data/x1f.yml
|
53
|
+
lib/stringex/unidecoder_data/x20.yml
|
54
|
+
lib/stringex/unidecoder_data/x21.yml
|
55
|
+
lib/stringex/unidecoder_data/x22.yml
|
56
|
+
lib/stringex/unidecoder_data/x23.yml
|
57
|
+
lib/stringex/unidecoder_data/x24.yml
|
58
|
+
lib/stringex/unidecoder_data/x25.yml
|
59
|
+
lib/stringex/unidecoder_data/x26.yml
|
60
|
+
lib/stringex/unidecoder_data/x27.yml
|
61
|
+
lib/stringex/unidecoder_data/x28.yml
|
62
|
+
lib/stringex/unidecoder_data/x2e.yml
|
63
|
+
lib/stringex/unidecoder_data/x2f.yml
|
64
|
+
lib/stringex/unidecoder_data/x30.yml
|
65
|
+
lib/stringex/unidecoder_data/x31.yml
|
66
|
+
lib/stringex/unidecoder_data/x32.yml
|
67
|
+
lib/stringex/unidecoder_data/x33.yml
|
68
|
+
lib/stringex/unidecoder_data/x4d.yml
|
69
|
+
lib/stringex/unidecoder_data/x4e.yml
|
70
|
+
lib/stringex/unidecoder_data/x4f.yml
|
71
|
+
lib/stringex/unidecoder_data/x50.yml
|
72
|
+
lib/stringex/unidecoder_data/x51.yml
|
73
|
+
lib/stringex/unidecoder_data/x52.yml
|
74
|
+
lib/stringex/unidecoder_data/x53.yml
|
75
|
+
lib/stringex/unidecoder_data/x54.yml
|
76
|
+
lib/stringex/unidecoder_data/x55.yml
|
77
|
+
lib/stringex/unidecoder_data/x56.yml
|
78
|
+
lib/stringex/unidecoder_data/x57.yml
|
79
|
+
lib/stringex/unidecoder_data/x58.yml
|
80
|
+
lib/stringex/unidecoder_data/x59.yml
|
81
|
+
lib/stringex/unidecoder_data/x5a.yml
|
82
|
+
lib/stringex/unidecoder_data/x5b.yml
|
83
|
+
lib/stringex/unidecoder_data/x5c.yml
|
84
|
+
lib/stringex/unidecoder_data/x5d.yml
|
85
|
+
lib/stringex/unidecoder_data/x5e.yml
|
86
|
+
lib/stringex/unidecoder_data/x5f.yml
|
87
|
+
lib/stringex/unidecoder_data/x60.yml
|
88
|
+
lib/stringex/unidecoder_data/x61.yml
|
89
|
+
lib/stringex/unidecoder_data/x62.yml
|
90
|
+
lib/stringex/unidecoder_data/x63.yml
|
91
|
+
lib/stringex/unidecoder_data/x64.yml
|
92
|
+
lib/stringex/unidecoder_data/x65.yml
|
93
|
+
lib/stringex/unidecoder_data/x66.yml
|
94
|
+
lib/stringex/unidecoder_data/x67.yml
|
95
|
+
lib/stringex/unidecoder_data/x68.yml
|
96
|
+
lib/stringex/unidecoder_data/x69.yml
|
97
|
+
lib/stringex/unidecoder_data/x6a.yml
|
98
|
+
lib/stringex/unidecoder_data/x6b.yml
|
99
|
+
lib/stringex/unidecoder_data/x6c.yml
|
100
|
+
lib/stringex/unidecoder_data/x6d.yml
|
101
|
+
lib/stringex/unidecoder_data/x6e.yml
|
102
|
+
lib/stringex/unidecoder_data/x6f.yml
|
103
|
+
lib/stringex/unidecoder_data/x70.yml
|
104
|
+
lib/stringex/unidecoder_data/x71.yml
|
105
|
+
lib/stringex/unidecoder_data/x72.yml
|
106
|
+
lib/stringex/unidecoder_data/x73.yml
|
107
|
+
lib/stringex/unidecoder_data/x74.yml
|
108
|
+
lib/stringex/unidecoder_data/x75.yml
|
109
|
+
lib/stringex/unidecoder_data/x76.yml
|
110
|
+
lib/stringex/unidecoder_data/x77.yml
|
111
|
+
lib/stringex/unidecoder_data/x78.yml
|
112
|
+
lib/stringex/unidecoder_data/x79.yml
|
113
|
+
lib/stringex/unidecoder_data/x7a.yml
|
114
|
+
lib/stringex/unidecoder_data/x7b.yml
|
115
|
+
lib/stringex/unidecoder_data/x7c.yml
|
116
|
+
lib/stringex/unidecoder_data/x7d.yml
|
117
|
+
lib/stringex/unidecoder_data/x7e.yml
|
118
|
+
lib/stringex/unidecoder_data/x7f.yml
|
119
|
+
lib/stringex/unidecoder_data/x80.yml
|
120
|
+
lib/stringex/unidecoder_data/x81.yml
|
121
|
+
lib/stringex/unidecoder_data/x82.yml
|
122
|
+
lib/stringex/unidecoder_data/x83.yml
|
123
|
+
lib/stringex/unidecoder_data/x84.yml
|
124
|
+
lib/stringex/unidecoder_data/x85.yml
|
125
|
+
lib/stringex/unidecoder_data/x86.yml
|
126
|
+
lib/stringex/unidecoder_data/x87.yml
|
127
|
+
lib/stringex/unidecoder_data/x88.yml
|
128
|
+
lib/stringex/unidecoder_data/x89.yml
|
129
|
+
lib/stringex/unidecoder_data/x8a.yml
|
130
|
+
lib/stringex/unidecoder_data/x8b.yml
|
131
|
+
lib/stringex/unidecoder_data/x8c.yml
|
132
|
+
lib/stringex/unidecoder_data/x8d.yml
|
133
|
+
lib/stringex/unidecoder_data/x8e.yml
|
134
|
+
lib/stringex/unidecoder_data/x8f.yml
|
135
|
+
lib/stringex/unidecoder_data/x90.yml
|
136
|
+
lib/stringex/unidecoder_data/x91.yml
|
137
|
+
lib/stringex/unidecoder_data/x92.yml
|
138
|
+
lib/stringex/unidecoder_data/x93.yml
|
139
|
+
lib/stringex/unidecoder_data/x94.yml
|
140
|
+
lib/stringex/unidecoder_data/x95.yml
|
141
|
+
lib/stringex/unidecoder_data/x96.yml
|
142
|
+
lib/stringex/unidecoder_data/x97.yml
|
143
|
+
lib/stringex/unidecoder_data/x98.yml
|
144
|
+
lib/stringex/unidecoder_data/x99.yml
|
145
|
+
lib/stringex/unidecoder_data/x9a.yml
|
146
|
+
lib/stringex/unidecoder_data/x9b.yml
|
147
|
+
lib/stringex/unidecoder_data/x9c.yml
|
148
|
+
lib/stringex/unidecoder_data/x9d.yml
|
149
|
+
lib/stringex/unidecoder_data/x9e.yml
|
150
|
+
lib/stringex/unidecoder_data/x9f.yml
|
151
|
+
lib/stringex/unidecoder_data/xa0.yml
|
152
|
+
lib/stringex/unidecoder_data/xa1.yml
|
153
|
+
lib/stringex/unidecoder_data/xa2.yml
|
154
|
+
lib/stringex/unidecoder_data/xa3.yml
|
155
|
+
lib/stringex/unidecoder_data/xa4.yml
|
156
|
+
lib/stringex/unidecoder_data/xac.yml
|
157
|
+
lib/stringex/unidecoder_data/xad.yml
|
158
|
+
lib/stringex/unidecoder_data/xae.yml
|
159
|
+
lib/stringex/unidecoder_data/xaf.yml
|
160
|
+
lib/stringex/unidecoder_data/xb0.yml
|
161
|
+
lib/stringex/unidecoder_data/xb1.yml
|
162
|
+
lib/stringex/unidecoder_data/xb2.yml
|
163
|
+
lib/stringex/unidecoder_data/xb3.yml
|
164
|
+
lib/stringex/unidecoder_data/xb4.yml
|
165
|
+
lib/stringex/unidecoder_data/xb5.yml
|
166
|
+
lib/stringex/unidecoder_data/xb6.yml
|
167
|
+
lib/stringex/unidecoder_data/xb7.yml
|
168
|
+
lib/stringex/unidecoder_data/xb8.yml
|
169
|
+
lib/stringex/unidecoder_data/xb9.yml
|
170
|
+
lib/stringex/unidecoder_data/xba.yml
|
171
|
+
lib/stringex/unidecoder_data/xbb.yml
|
172
|
+
lib/stringex/unidecoder_data/xbc.yml
|
173
|
+
lib/stringex/unidecoder_data/xbd.yml
|
174
|
+
lib/stringex/unidecoder_data/xbe.yml
|
175
|
+
lib/stringex/unidecoder_data/xbf.yml
|
176
|
+
lib/stringex/unidecoder_data/xc0.yml
|
177
|
+
lib/stringex/unidecoder_data/xc1.yml
|
178
|
+
lib/stringex/unidecoder_data/xc2.yml
|
179
|
+
lib/stringex/unidecoder_data/xc3.yml
|
180
|
+
lib/stringex/unidecoder_data/xc4.yml
|
181
|
+
lib/stringex/unidecoder_data/xc5.yml
|
182
|
+
lib/stringex/unidecoder_data/xc6.yml
|
183
|
+
lib/stringex/unidecoder_data/xc7.yml
|
184
|
+
lib/stringex/unidecoder_data/xc8.yml
|
185
|
+
lib/stringex/unidecoder_data/xc9.yml
|
186
|
+
lib/stringex/unidecoder_data/xca.yml
|
187
|
+
lib/stringex/unidecoder_data/xcb.yml
|
188
|
+
lib/stringex/unidecoder_data/xcc.yml
|
189
|
+
lib/stringex/unidecoder_data/xcd.yml
|
190
|
+
lib/stringex/unidecoder_data/xce.yml
|
191
|
+
lib/stringex/unidecoder_data/xcf.yml
|
192
|
+
lib/stringex/unidecoder_data/xd0.yml
|
193
|
+
lib/stringex/unidecoder_data/xd1.yml
|
194
|
+
lib/stringex/unidecoder_data/xd2.yml
|
195
|
+
lib/stringex/unidecoder_data/xd3.yml
|
196
|
+
lib/stringex/unidecoder_data/xd4.yml
|
197
|
+
lib/stringex/unidecoder_data/xd5.yml
|
198
|
+
lib/stringex/unidecoder_data/xd6.yml
|
199
|
+
lib/stringex/unidecoder_data/xd7.yml
|
200
|
+
lib/stringex/unidecoder_data/xf9.yml
|
201
|
+
lib/stringex/unidecoder_data/xfa.yml
|
202
|
+
lib/stringex/unidecoder_data/xfb.yml
|
203
|
+
lib/stringex/unidecoder_data/xfc.yml
|
204
|
+
lib/stringex/unidecoder_data/xfd.yml
|
205
|
+
lib/stringex/unidecoder_data/xfe.yml
|
206
|
+
lib/stringex/unidecoder_data/xff.yml
|
207
207
|
}
|
208
208
|
gem.test_files = %w{
|
209
209
|
test/acts_as_url_test.rb
|
@@ -212,7 +212,7 @@ begin
|
|
212
212
|
}
|
213
213
|
gem.rdoc_options = %w{--main README.rdoc --charset utf-8 --line-numbers}
|
214
214
|
gem.extra_rdoc_files = %w{MIT-LICENSE README.rdoc}
|
215
|
-
gem.version = "1.3.
|
215
|
+
gem.version = "1.3.2"
|
216
216
|
end
|
217
217
|
|
218
218
|
Jeweler::GemcutterTasks.new
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
module Stringex
|
3
|
+
module ActsAsUrl # :nodoc:
|
4
|
+
def self.included(base)
|
5
|
+
base.extend ClassMethods
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods # :doc:
|
9
|
+
# Creates a callback to automatically create an url-friendly representation
|
10
|
+
# of the <tt>attribute</tt> argument. Example:
|
11
|
+
#
|
12
|
+
# act_as_url :title
|
13
|
+
#
|
14
|
+
# will use the string contents of the <tt>title</tt> attribute
|
15
|
+
# to create the permalink. <strong>Note:</strong> you can also use a non-database-backed
|
16
|
+
# method to supply the string contents for the permalink. Just use that method's name
|
17
|
+
# as the argument as you would an attribute.
|
18
|
+
#
|
19
|
+
# The default attribute <tt>acts_as_url</tt> uses to save the permalink is <tt>url</tt>
|
20
|
+
# but this can be changed in the options hash. Available options are:
|
21
|
+
#
|
22
|
+
# <tt>:url_attribute</tt>:: The name of the attribute to use for storing the generated url string.
|
23
|
+
# Default is <tt>:url</tt>
|
24
|
+
# <tt>:scope</tt>:: The name of model attribute to scope unique urls to. There is no default here.
|
25
|
+
# <tt>:only_when_blank</tt>:: If true, the url generation will only happen when <tt>:url_attribute</tt> is
|
26
|
+
# blank. Default is false (meaning url generation will happen always)
|
27
|
+
# <tt>:sync_url</tt>:: If set to true, the url field will be updated when changes are made to the
|
28
|
+
# attribute it is based on. Default is false.
|
29
|
+
def acts_as_url(attribute, options = {})
|
30
|
+
cattr_accessor :attribute_to_urlify
|
31
|
+
cattr_accessor :scope_for_url
|
32
|
+
cattr_accessor :url_attribute # The attribute on the DB
|
33
|
+
cattr_accessor :only_when_blank
|
34
|
+
cattr_accessor :duplicate_count_separator
|
35
|
+
cattr_accessor :allow_slash
|
36
|
+
|
37
|
+
if options[:sync_url]
|
38
|
+
before_validation(:ensure_unique_url)
|
39
|
+
else
|
40
|
+
if defined?(ActiveModel::Callbacks)
|
41
|
+
before_validation(:ensure_unique_url, :on => :create)
|
42
|
+
else
|
43
|
+
before_validation_on_create(:ensure_unique_url)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
self.attribute_to_urlify = attribute
|
48
|
+
self.scope_for_url = options[:scope]
|
49
|
+
self.url_attribute = options[:url_attribute] || "url"
|
50
|
+
self.only_when_blank = options[:only_when_blank] || false
|
51
|
+
self.duplicate_count_separator = options[:duplicate_count_separator] || "-"
|
52
|
+
self.allow_slash = options[:allow_slash] || false
|
53
|
+
|
54
|
+
class_eval <<-"END"
|
55
|
+
def #{url_attribute}
|
56
|
+
if !new_record? && errors[attribute_to_urlify].present?
|
57
|
+
self.class.find(id).send(url_attribute)
|
58
|
+
else
|
59
|
+
read_attribute(url_attribute)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
END
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initialize the url fields for the records that need it. Designed for people who add
|
66
|
+
# <tt>acts_as_url</tt> support once there's already development/production data they'd
|
67
|
+
# like to keep around.
|
68
|
+
#
|
69
|
+
# Note: This method can get very expensive, very fast. If you're planning on using this
|
70
|
+
# on a large selection, you will get much better results writing your own version with
|
71
|
+
# using pagination.
|
72
|
+
def initialize_urls
|
73
|
+
find(:all, :conditions => {self.url_attribute => nil}).each do |instance|
|
74
|
+
instance.send :ensure_unique_url
|
75
|
+
instance.save
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def ensure_unique_url
|
83
|
+
url_attribute = self.class.url_attribute
|
84
|
+
separator = self.class.duplicate_count_separator
|
85
|
+
base_url = self.send(url_attribute)
|
86
|
+
base_url = self.send(self.class.attribute_to_urlify).to_s.to_url(:allow_slash => self.allow_slash) if base_url.blank? || !self.only_when_blank
|
87
|
+
conditions = ["#{url_attribute} LIKE ?", base_url+'%']
|
88
|
+
unless new_record?
|
89
|
+
conditions.first << " and id != ?"
|
90
|
+
conditions << id
|
91
|
+
end
|
92
|
+
if self.class.scope_for_url
|
93
|
+
conditions.first << " and #{self.class.scope_for_url} = ?"
|
94
|
+
conditions << send(self.class.scope_for_url)
|
95
|
+
end
|
96
|
+
url_owners = self.class.find(:all, :conditions => conditions)
|
97
|
+
write_attribute url_attribute, base_url
|
98
|
+
if url_owners.any?{|owner| owner.send(url_attribute) == base_url}
|
99
|
+
n = 1
|
100
|
+
while url_owners.any?{|owner| owner.send(url_attribute) == "#{base_url}#{separator}#{n}"}
|
101
|
+
n = n.succ
|
102
|
+
end
|
103
|
+
write_attribute url_attribute, "#{base_url}#{separator}#{n}"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|