rsl-stringex 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/Rakefile +223 -2
- data/lib/lucky_sneaks/acts_as_url.rb +7 -1
- data/lib/lucky_sneaks/string_extensions.rb +15 -3
- data/lib/lucky_sneaks/unidecoder.rb +19 -6
- data/lib/lucky_sneaks/unidecoder_data/x00.yml +3 -3
- data/lib/lucky_sneaks/unidecoder_data/x02.yml +2 -2
- data/lib/lucky_sneaks/unidecoder_data/x04.yml +1 -1
- data/lib/lucky_sneaks/unidecoder_data/x20.yml +11 -11
- data/lib/lucky_sneaks/unidecoder_data/x21.yml +22 -22
- data/lib/lucky_sneaks/unidecoder_data/x22.yml +7 -7
- data/lib/lucky_sneaks/unidecoder_data/x23.yml +3 -3
- data/lib/lucky_sneaks/unidecoder_data/x26.yml +1 -1
- data/lib/lucky_sneaks/unidecoder_data/x27.yml +5 -5
- data/lib/lucky_sneaks/unidecoder_data/x30.yml +1 -1
- data/lib/stringex.rb +1 -1
- data/test/acts_as_url_test.rb +46 -3
- data/test/string_extensions_test.rb +7 -3
- data/test/unidecoder_test.rb +26 -4
- metadata +6 -7
- data/stringex.gemspec +0 -209
data/README.rdoc
CHANGED
@@ -13,6 +13,8 @@ which will populate the <tt>url</tt> attribute on the object with the converted
|
|
13
13
|
<tt>:url_attribute</tt>:: The name of the attribute to use for storing the generated url string.
|
14
14
|
Default is <tt>:url</tt>
|
15
15
|
<tt>:scope</tt>:: The name of model attribute to scope unique urls to. There is no default here.
|
16
|
+
<tt>:only_when_blank</tt>:: If true, the url generation will only happen when <tt>:url_attribute</tt> is
|
17
|
+
blank. Default is false (meaning url generation will happen always)
|
16
18
|
<tt>:sync_url</tt>:: If set to true, the url field will be updated when changes are made to the
|
17
19
|
attribute it is based on. Default is false.
|
18
20
|
|
data/Rakefile
CHANGED
@@ -2,10 +2,224 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = "stringex"
|
9
|
+
gem.authors = ["Russell Norris"]
|
10
|
+
gem.email = "rsl@luckysneaks.com"
|
11
|
+
gem.homepage = "http://github.com/rsl/stringex"
|
12
|
+
gem.summary = "Some [hopefully] useful extensions to Ruby’s String class"
|
13
|
+
gem.description = "Some [hopefully] useful extensions to Ruby’s String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to Ascii transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
|
14
|
+
gem.has_rdoc = true
|
15
|
+
gem.files = %w{
|
16
|
+
init.rb
|
17
|
+
MIT-LICENSE
|
18
|
+
Rakefile
|
19
|
+
README.rdoc
|
20
|
+
stringex.gemspec
|
21
|
+
lib/stringex.rb
|
22
|
+
lib/lucky_sneaks/acts_as_url.rb
|
23
|
+
lib/lucky_sneaks/string_extensions.rb
|
24
|
+
lib/lucky_sneaks/unidecoder.rb
|
25
|
+
lib/lucky_sneaks/unidecoder_data/x00.yml
|
26
|
+
lib/lucky_sneaks/unidecoder_data/x01.yml
|
27
|
+
lib/lucky_sneaks/unidecoder_data/x02.yml
|
28
|
+
lib/lucky_sneaks/unidecoder_data/x03.yml
|
29
|
+
lib/lucky_sneaks/unidecoder_data/x04.yml
|
30
|
+
lib/lucky_sneaks/unidecoder_data/x05.yml
|
31
|
+
lib/lucky_sneaks/unidecoder_data/x06.yml
|
32
|
+
lib/lucky_sneaks/unidecoder_data/x07.yml
|
33
|
+
lib/lucky_sneaks/unidecoder_data/x09.yml
|
34
|
+
lib/lucky_sneaks/unidecoder_data/x0a.yml
|
35
|
+
lib/lucky_sneaks/unidecoder_data/x0b.yml
|
36
|
+
lib/lucky_sneaks/unidecoder_data/x0c.yml
|
37
|
+
lib/lucky_sneaks/unidecoder_data/x0d.yml
|
38
|
+
lib/lucky_sneaks/unidecoder_data/x0e.yml
|
39
|
+
lib/lucky_sneaks/unidecoder_data/x0f.yml
|
40
|
+
lib/lucky_sneaks/unidecoder_data/x10.yml
|
41
|
+
lib/lucky_sneaks/unidecoder_data/x11.yml
|
42
|
+
lib/lucky_sneaks/unidecoder_data/x12.yml
|
43
|
+
lib/lucky_sneaks/unidecoder_data/x13.yml
|
44
|
+
lib/lucky_sneaks/unidecoder_data/x14.yml
|
45
|
+
lib/lucky_sneaks/unidecoder_data/x15.yml
|
46
|
+
lib/lucky_sneaks/unidecoder_data/x16.yml
|
47
|
+
lib/lucky_sneaks/unidecoder_data/x17.yml
|
48
|
+
lib/lucky_sneaks/unidecoder_data/x18.yml
|
49
|
+
lib/lucky_sneaks/unidecoder_data/x1e.yml
|
50
|
+
lib/lucky_sneaks/unidecoder_data/x1f.yml
|
51
|
+
lib/lucky_sneaks/unidecoder_data/x20.yml
|
52
|
+
lib/lucky_sneaks/unidecoder_data/x21.yml
|
53
|
+
lib/lucky_sneaks/unidecoder_data/x22.yml
|
54
|
+
lib/lucky_sneaks/unidecoder_data/x23.yml
|
55
|
+
lib/lucky_sneaks/unidecoder_data/x24.yml
|
56
|
+
lib/lucky_sneaks/unidecoder_data/x25.yml
|
57
|
+
lib/lucky_sneaks/unidecoder_data/x26.yml
|
58
|
+
lib/lucky_sneaks/unidecoder_data/x27.yml
|
59
|
+
lib/lucky_sneaks/unidecoder_data/x28.yml
|
60
|
+
lib/lucky_sneaks/unidecoder_data/x2e.yml
|
61
|
+
lib/lucky_sneaks/unidecoder_data/x2f.yml
|
62
|
+
lib/lucky_sneaks/unidecoder_data/x30.yml
|
63
|
+
lib/lucky_sneaks/unidecoder_data/x31.yml
|
64
|
+
lib/lucky_sneaks/unidecoder_data/x32.yml
|
65
|
+
lib/lucky_sneaks/unidecoder_data/x33.yml
|
66
|
+
lib/lucky_sneaks/unidecoder_data/x4d.yml
|
67
|
+
lib/lucky_sneaks/unidecoder_data/x4e.yml
|
68
|
+
lib/lucky_sneaks/unidecoder_data/x4f.yml
|
69
|
+
lib/lucky_sneaks/unidecoder_data/x50.yml
|
70
|
+
lib/lucky_sneaks/unidecoder_data/x51.yml
|
71
|
+
lib/lucky_sneaks/unidecoder_data/x52.yml
|
72
|
+
lib/lucky_sneaks/unidecoder_data/x53.yml
|
73
|
+
lib/lucky_sneaks/unidecoder_data/x54.yml
|
74
|
+
lib/lucky_sneaks/unidecoder_data/x55.yml
|
75
|
+
lib/lucky_sneaks/unidecoder_data/x56.yml
|
76
|
+
lib/lucky_sneaks/unidecoder_data/x57.yml
|
77
|
+
lib/lucky_sneaks/unidecoder_data/x58.yml
|
78
|
+
lib/lucky_sneaks/unidecoder_data/x59.yml
|
79
|
+
lib/lucky_sneaks/unidecoder_data/x5a.yml
|
80
|
+
lib/lucky_sneaks/unidecoder_data/x5b.yml
|
81
|
+
lib/lucky_sneaks/unidecoder_data/x5c.yml
|
82
|
+
lib/lucky_sneaks/unidecoder_data/x5d.yml
|
83
|
+
lib/lucky_sneaks/unidecoder_data/x5e.yml
|
84
|
+
lib/lucky_sneaks/unidecoder_data/x5f.yml
|
85
|
+
lib/lucky_sneaks/unidecoder_data/x60.yml
|
86
|
+
lib/lucky_sneaks/unidecoder_data/x61.yml
|
87
|
+
lib/lucky_sneaks/unidecoder_data/x62.yml
|
88
|
+
lib/lucky_sneaks/unidecoder_data/x63.yml
|
89
|
+
lib/lucky_sneaks/unidecoder_data/x64.yml
|
90
|
+
lib/lucky_sneaks/unidecoder_data/x65.yml
|
91
|
+
lib/lucky_sneaks/unidecoder_data/x66.yml
|
92
|
+
lib/lucky_sneaks/unidecoder_data/x67.yml
|
93
|
+
lib/lucky_sneaks/unidecoder_data/x68.yml
|
94
|
+
lib/lucky_sneaks/unidecoder_data/x69.yml
|
95
|
+
lib/lucky_sneaks/unidecoder_data/x6a.yml
|
96
|
+
lib/lucky_sneaks/unidecoder_data/x6b.yml
|
97
|
+
lib/lucky_sneaks/unidecoder_data/x6c.yml
|
98
|
+
lib/lucky_sneaks/unidecoder_data/x6d.yml
|
99
|
+
lib/lucky_sneaks/unidecoder_data/x6e.yml
|
100
|
+
lib/lucky_sneaks/unidecoder_data/x6f.yml
|
101
|
+
lib/lucky_sneaks/unidecoder_data/x70.yml
|
102
|
+
lib/lucky_sneaks/unidecoder_data/x71.yml
|
103
|
+
lib/lucky_sneaks/unidecoder_data/x72.yml
|
104
|
+
lib/lucky_sneaks/unidecoder_data/x73.yml
|
105
|
+
lib/lucky_sneaks/unidecoder_data/x74.yml
|
106
|
+
lib/lucky_sneaks/unidecoder_data/x75.yml
|
107
|
+
lib/lucky_sneaks/unidecoder_data/x76.yml
|
108
|
+
lib/lucky_sneaks/unidecoder_data/x77.yml
|
109
|
+
lib/lucky_sneaks/unidecoder_data/x78.yml
|
110
|
+
lib/lucky_sneaks/unidecoder_data/x79.yml
|
111
|
+
lib/lucky_sneaks/unidecoder_data/x7a.yml
|
112
|
+
lib/lucky_sneaks/unidecoder_data/x7b.yml
|
113
|
+
lib/lucky_sneaks/unidecoder_data/x7c.yml
|
114
|
+
lib/lucky_sneaks/unidecoder_data/x7d.yml
|
115
|
+
lib/lucky_sneaks/unidecoder_data/x7e.yml
|
116
|
+
lib/lucky_sneaks/unidecoder_data/x7f.yml
|
117
|
+
lib/lucky_sneaks/unidecoder_data/x80.yml
|
118
|
+
lib/lucky_sneaks/unidecoder_data/x81.yml
|
119
|
+
lib/lucky_sneaks/unidecoder_data/x82.yml
|
120
|
+
lib/lucky_sneaks/unidecoder_data/x83.yml
|
121
|
+
lib/lucky_sneaks/unidecoder_data/x84.yml
|
122
|
+
lib/lucky_sneaks/unidecoder_data/x85.yml
|
123
|
+
lib/lucky_sneaks/unidecoder_data/x86.yml
|
124
|
+
lib/lucky_sneaks/unidecoder_data/x87.yml
|
125
|
+
lib/lucky_sneaks/unidecoder_data/x88.yml
|
126
|
+
lib/lucky_sneaks/unidecoder_data/x89.yml
|
127
|
+
lib/lucky_sneaks/unidecoder_data/x8a.yml
|
128
|
+
lib/lucky_sneaks/unidecoder_data/x8b.yml
|
129
|
+
lib/lucky_sneaks/unidecoder_data/x8c.yml
|
130
|
+
lib/lucky_sneaks/unidecoder_data/x8d.yml
|
131
|
+
lib/lucky_sneaks/unidecoder_data/x8e.yml
|
132
|
+
lib/lucky_sneaks/unidecoder_data/x8f.yml
|
133
|
+
lib/lucky_sneaks/unidecoder_data/x90.yml
|
134
|
+
lib/lucky_sneaks/unidecoder_data/x91.yml
|
135
|
+
lib/lucky_sneaks/unidecoder_data/x92.yml
|
136
|
+
lib/lucky_sneaks/unidecoder_data/x93.yml
|
137
|
+
lib/lucky_sneaks/unidecoder_data/x94.yml
|
138
|
+
lib/lucky_sneaks/unidecoder_data/x95.yml
|
139
|
+
lib/lucky_sneaks/unidecoder_data/x96.yml
|
140
|
+
lib/lucky_sneaks/unidecoder_data/x97.yml
|
141
|
+
lib/lucky_sneaks/unidecoder_data/x98.yml
|
142
|
+
lib/lucky_sneaks/unidecoder_data/x99.yml
|
143
|
+
lib/lucky_sneaks/unidecoder_data/x9a.yml
|
144
|
+
lib/lucky_sneaks/unidecoder_data/x9b.yml
|
145
|
+
lib/lucky_sneaks/unidecoder_data/x9c.yml
|
146
|
+
lib/lucky_sneaks/unidecoder_data/x9d.yml
|
147
|
+
lib/lucky_sneaks/unidecoder_data/x9e.yml
|
148
|
+
lib/lucky_sneaks/unidecoder_data/x9f.yml
|
149
|
+
lib/lucky_sneaks/unidecoder_data/xa0.yml
|
150
|
+
lib/lucky_sneaks/unidecoder_data/xa1.yml
|
151
|
+
lib/lucky_sneaks/unidecoder_data/xa2.yml
|
152
|
+
lib/lucky_sneaks/unidecoder_data/xa3.yml
|
153
|
+
lib/lucky_sneaks/unidecoder_data/xa4.yml
|
154
|
+
lib/lucky_sneaks/unidecoder_data/xac.yml
|
155
|
+
lib/lucky_sneaks/unidecoder_data/xad.yml
|
156
|
+
lib/lucky_sneaks/unidecoder_data/xae.yml
|
157
|
+
lib/lucky_sneaks/unidecoder_data/xaf.yml
|
158
|
+
lib/lucky_sneaks/unidecoder_data/xb0.yml
|
159
|
+
lib/lucky_sneaks/unidecoder_data/xb1.yml
|
160
|
+
lib/lucky_sneaks/unidecoder_data/xb2.yml
|
161
|
+
lib/lucky_sneaks/unidecoder_data/xb3.yml
|
162
|
+
lib/lucky_sneaks/unidecoder_data/xb4.yml
|
163
|
+
lib/lucky_sneaks/unidecoder_data/xb5.yml
|
164
|
+
lib/lucky_sneaks/unidecoder_data/xb6.yml
|
165
|
+
lib/lucky_sneaks/unidecoder_data/xb7.yml
|
166
|
+
lib/lucky_sneaks/unidecoder_data/xb8.yml
|
167
|
+
lib/lucky_sneaks/unidecoder_data/xb9.yml
|
168
|
+
lib/lucky_sneaks/unidecoder_data/xba.yml
|
169
|
+
lib/lucky_sneaks/unidecoder_data/xbb.yml
|
170
|
+
lib/lucky_sneaks/unidecoder_data/xbc.yml
|
171
|
+
lib/lucky_sneaks/unidecoder_data/xbd.yml
|
172
|
+
lib/lucky_sneaks/unidecoder_data/xbe.yml
|
173
|
+
lib/lucky_sneaks/unidecoder_data/xbf.yml
|
174
|
+
lib/lucky_sneaks/unidecoder_data/xc0.yml
|
175
|
+
lib/lucky_sneaks/unidecoder_data/xc1.yml
|
176
|
+
lib/lucky_sneaks/unidecoder_data/xc2.yml
|
177
|
+
lib/lucky_sneaks/unidecoder_data/xc3.yml
|
178
|
+
lib/lucky_sneaks/unidecoder_data/xc4.yml
|
179
|
+
lib/lucky_sneaks/unidecoder_data/xc5.yml
|
180
|
+
lib/lucky_sneaks/unidecoder_data/xc6.yml
|
181
|
+
lib/lucky_sneaks/unidecoder_data/xc7.yml
|
182
|
+
lib/lucky_sneaks/unidecoder_data/xc8.yml
|
183
|
+
lib/lucky_sneaks/unidecoder_data/xc9.yml
|
184
|
+
lib/lucky_sneaks/unidecoder_data/xca.yml
|
185
|
+
lib/lucky_sneaks/unidecoder_data/xcb.yml
|
186
|
+
lib/lucky_sneaks/unidecoder_data/xcc.yml
|
187
|
+
lib/lucky_sneaks/unidecoder_data/xcd.yml
|
188
|
+
lib/lucky_sneaks/unidecoder_data/xce.yml
|
189
|
+
lib/lucky_sneaks/unidecoder_data/xcf.yml
|
190
|
+
lib/lucky_sneaks/unidecoder_data/xd0.yml
|
191
|
+
lib/lucky_sneaks/unidecoder_data/xd1.yml
|
192
|
+
lib/lucky_sneaks/unidecoder_data/xd2.yml
|
193
|
+
lib/lucky_sneaks/unidecoder_data/xd3.yml
|
194
|
+
lib/lucky_sneaks/unidecoder_data/xd4.yml
|
195
|
+
lib/lucky_sneaks/unidecoder_data/xd5.yml
|
196
|
+
lib/lucky_sneaks/unidecoder_data/xd6.yml
|
197
|
+
lib/lucky_sneaks/unidecoder_data/xd7.yml
|
198
|
+
lib/lucky_sneaks/unidecoder_data/xf9.yml
|
199
|
+
lib/lucky_sneaks/unidecoder_data/xfa.yml
|
200
|
+
lib/lucky_sneaks/unidecoder_data/xfb.yml
|
201
|
+
lib/lucky_sneaks/unidecoder_data/xfc.yml
|
202
|
+
lib/lucky_sneaks/unidecoder_data/xfd.yml
|
203
|
+
lib/lucky_sneaks/unidecoder_data/xfe.yml
|
204
|
+
lib/lucky_sneaks/unidecoder_data/xff.yml
|
205
|
+
}
|
206
|
+
gem.test_files = %w{
|
207
|
+
test/acts_as_url_test.rb
|
208
|
+
test/string_extensions_test.rb
|
209
|
+
test/unidecoder_test.rb
|
210
|
+
}
|
211
|
+
gem.rdoc_options = %w{--main README.rdoc --charset utf-8 --line-numbers}
|
212
|
+
gem.extra_rdoc_files = %w{MIT-LICENSE README.rdoc}
|
213
|
+
end
|
214
|
+
|
215
|
+
rescue LoadError
|
216
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
217
|
+
end
|
218
|
+
|
5
219
|
desc 'Default: run unit tests.'
|
6
220
|
task :default => [:refresh_db, :test]
|
7
221
|
|
8
|
-
desc 'Remove old sqlite file'
|
222
|
+
desc 'Remove old sqlite file.'
|
9
223
|
task :refresh_db do
|
10
224
|
`rm -f #{File.dirname(__FILE__)}/test/acts_as_url.sqlite3`
|
11
225
|
end
|
@@ -19,8 +233,15 @@ end
|
|
19
233
|
|
20
234
|
desc 'Generate documentation for the stringex plugin.'
|
21
235
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
236
|
+
if File.exist?('VERSION.yml')
|
237
|
+
config = YAML.load(File.read('VERSION.yml'))
|
238
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
239
|
+
else
|
240
|
+
version = ""
|
241
|
+
end
|
242
|
+
|
22
243
|
rdoc.rdoc_dir = 'doc'
|
23
|
-
rdoc.title = 'Stringex: A String Extension Pack'
|
244
|
+
rdoc.title = 'Stringex: A String Extension Pack [#{version}]'
|
24
245
|
rdoc.options << '--line-numbers' << '--inline-source'
|
25
246
|
rdoc.options << '--charset' << 'utf-8'
|
26
247
|
rdoc.rdoc_files.include('README.rdoc')
|
@@ -21,12 +21,15 @@ module LuckySneaks
|
|
21
21
|
# <tt>:url_attribute</tt>:: The name of the attribute to use for storing the generated url string.
|
22
22
|
# Default is <tt>:url</tt>
|
23
23
|
# <tt>:scope</tt>:: The name of model attribute to scope unique urls to. There is no default here.
|
24
|
+
# <tt>:only_when_blank</tt>:: If true, the url generation will only happen when <tt>:url_attribute</tt> is
|
25
|
+
# blank. Default is false (meaning url generation will happen always)
|
24
26
|
# <tt>:sync_url</tt>:: If set to true, the url field will be updated when changes are made to the
|
25
27
|
# attribute it is based on. Default is false.
|
26
28
|
def acts_as_url(attribute, options = {})
|
27
29
|
cattr_accessor :attribute_to_urlify
|
28
30
|
cattr_accessor :scope_for_url
|
29
31
|
cattr_accessor :url_attribute # The attribute on the DB
|
32
|
+
cattr_accessor :only_when_blank
|
30
33
|
|
31
34
|
if options[:sync_url]
|
32
35
|
before_validation :ensure_unique_url
|
@@ -37,6 +40,7 @@ module LuckySneaks
|
|
37
40
|
self.attribute_to_urlify = attribute
|
38
41
|
self.scope_for_url = options[:scope]
|
39
42
|
self.url_attribute = options[:url_attribute] || "url"
|
43
|
+
self.only_when_blank = options[:only_when_blank] || false
|
40
44
|
end
|
41
45
|
|
42
46
|
# Initialize the url fields for the records that need it. Designed for people who add
|
@@ -57,7 +61,8 @@ module LuckySneaks
|
|
57
61
|
private
|
58
62
|
def ensure_unique_url
|
59
63
|
url_attribute = self.class.url_attribute
|
60
|
-
base_url = self.send(
|
64
|
+
base_url = self.send(url_attribute)
|
65
|
+
base_url = self.send(self.class.attribute_to_urlify).to_s.to_url if base_url.blank? || !self.only_when_blank
|
61
66
|
conditions = ["#{url_attribute} LIKE ?", base_url+'%']
|
62
67
|
unless new_record?
|
63
68
|
conditions.first << " and id != ?"
|
@@ -69,6 +74,7 @@ module LuckySneaks
|
|
69
74
|
end
|
70
75
|
url_owners = self.class.find(:all, :conditions => conditions)
|
71
76
|
if url_owners.size > 0
|
77
|
+
return unless url_owners.map { |o| o.send(url_attribute) }.include?(base_url)
|
72
78
|
n = 1
|
73
79
|
while url_owners.detect{|u| u.send(url_attribute) == "#{base_url}-#{n}"}
|
74
80
|
n = n.succ
|
@@ -5,8 +5,8 @@ module LuckySneaks
|
|
5
5
|
base.extend(ClassMethods)
|
6
6
|
end
|
7
7
|
|
8
|
-
# Returns the string converted (via Textile/RedCloth) to HTML format
|
9
|
-
# self if Redcloth is not available.
|
8
|
+
# Returns the string converted (via Textile/RedCloth) to HTML format
|
9
|
+
# or self [with a friendly warning] if Redcloth is not available.
|
10
10
|
#
|
11
11
|
# Using <tt>:lite</tt> argument will cause RedCloth to not wrap the HTML in a container
|
12
12
|
# P element, which is useful behavior for generating header element text, etc.
|
@@ -25,6 +25,7 @@ module LuckySneaks
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
else
|
28
|
+
warn "String#to_html was called without RedCloth being successfully required"
|
28
29
|
self
|
29
30
|
end
|
30
31
|
end
|
@@ -39,7 +40,7 @@ module LuckySneaks
|
|
39
40
|
# Performs multiple text manipulations. Essentially a shortcut for typing them all. View source
|
40
41
|
# below to see which methods are run.
|
41
42
|
def remove_formatting
|
42
|
-
|
43
|
+
strip_html_tags.convert_accented_entities.convert_misc_entities.convert_misc_characters.to_ascii.collapse
|
43
44
|
end
|
44
45
|
|
45
46
|
# Removes HTML tags from text. This code is simplified from Tobias Luettke's regular expression
|
@@ -116,12 +117,23 @@ module LuckySneaks
|
|
116
117
|
# before running this method.
|
117
118
|
def convert_misc_characters
|
118
119
|
dummy = dup.gsub(/\.{3,}/, " dot dot dot ") # Catch ellipses before single dot rule!
|
120
|
+
# Special rules for money
|
121
|
+
{
|
122
|
+
/(\s|^)\$(\d+)\.(\d+)(\s|$)/ => '\2 dollars \3 cents',
|
123
|
+
/(\s|^)£(\d+)\.(\d+)(\s|$)/u => '\2 pounds \3 pence',
|
124
|
+
}.each do |found, replaced|
|
125
|
+
replaced = " #{replaced} " unless replaced =~ /\\1/
|
126
|
+
dummy.gsub!(found, replaced)
|
127
|
+
end
|
128
|
+
# Back to normal rules
|
119
129
|
{
|
120
130
|
/\s*&\s*/ => "and",
|
121
131
|
/\s*#/ => "number",
|
122
132
|
/\s*@\s*/ => "at",
|
123
133
|
/(\S|^)\.(\S)/ => '\1 dot \2',
|
124
134
|
/(\s|^)\$(\d*)(\s|$)/ => '\2 dollars',
|
135
|
+
/(\s|^)£(\d*)(\s|$)/u => '\2 pounds',
|
136
|
+
/(\s|^)¥(\d*)(\s|$)/u => '\2 yen',
|
125
137
|
/\s*\*\s*/ => "star",
|
126
138
|
/\s*%\s*/ => "percent",
|
127
139
|
/\s*(\\|\/)\s*/ => "slash",
|
@@ -13,24 +13,37 @@ module LuckySneaks
|
|
13
13
|
# You're probably better off just using the added String#to_ascii
|
14
14
|
def decode(string)
|
15
15
|
string.gsub(/[^\x00-\x7f]/u) do |codepoint|
|
16
|
+
unpacked = codepoint.unpack("U")[0]
|
16
17
|
begin
|
17
|
-
CODEPOINTS[code_group(
|
18
|
+
CODEPOINTS[code_group(unpacked)][grouped_point(unpacked)]
|
18
19
|
rescue
|
19
20
|
# Hopefully this won't come up much
|
20
21
|
"?"
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
26
|
+
# Returns character for the given Unicode codepoint
|
27
|
+
def encode(codepoint)
|
28
|
+
["0x#{codepoint}".to_i(16)].pack("U")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns string indicating which file (and line) contains the
|
32
|
+
# transliteration value for the character
|
33
|
+
def in_yaml_file(character)
|
34
|
+
unpacked = character.unpack("U")[0]
|
35
|
+
"#{code_group(unpacked)}.yml (line #{grouped_point(unpacked) + 2})"
|
36
|
+
end
|
24
37
|
|
25
38
|
private
|
26
39
|
# Returns the Unicode codepoint grouping for the given character
|
27
|
-
def code_group(
|
28
|
-
"x%02x" % (
|
40
|
+
def code_group(unpacked_character)
|
41
|
+
"x%02x" % (unpacked_character >> 8)
|
29
42
|
end
|
30
43
|
|
31
44
|
# Returns the index of the given character in the YAML file for its codepoint group
|
32
|
-
def grouped_point(
|
33
|
-
|
45
|
+
def grouped_point(unpacked_character)
|
46
|
+
unpacked_character & 255
|
34
47
|
end
|
35
48
|
end
|
36
49
|
end
|
@@ -42,7 +55,7 @@ module LuckySneaks
|
|
42
55
|
#
|
43
56
|
# "⠋⠗⠁⠝⠉⠑".to_ascii #=> "braille"
|
44
57
|
def to_ascii
|
45
|
-
LuckySneaks::Unidecoder
|
58
|
+
LuckySneaks::Unidecoder.decode(self)
|
46
59
|
end
|
47
60
|
end
|
48
61
|
end
|
@@ -126,7 +126,7 @@
|
|
126
126
|
- '|'
|
127
127
|
- '}'
|
128
128
|
- '~'
|
129
|
-
-
|
129
|
+
- ''
|
130
130
|
- ''
|
131
131
|
- ''
|
132
132
|
- ''
|
@@ -160,7 +160,7 @@
|
|
160
160
|
- ''
|
161
161
|
- ''
|
162
162
|
- ' '
|
163
|
-
- '
|
163
|
+
- ''
|
164
164
|
- C/
|
165
165
|
- PS
|
166
166
|
- $?
|
@@ -190,7 +190,7 @@
|
|
190
190
|
- 1/4
|
191
191
|
- 1/2
|
192
192
|
- 3/4
|
193
|
-
- '
|
193
|
+
- ''
|
194
194
|
- A
|
195
195
|
- A
|
196
196
|
- A
|
@@ -10,15 +10,15 @@
|
|
10
10
|
- ' '
|
11
11
|
- ' '
|
12
12
|
- ' '
|
13
|
-
- ' '
|
14
13
|
- ''
|
15
14
|
- ''
|
16
15
|
- ''
|
17
16
|
- ''
|
18
|
-
-
|
19
|
-
- -
|
20
|
-
- -
|
21
|
-
- -
|
17
|
+
- ''
|
18
|
+
- '-'
|
19
|
+
- '-'
|
20
|
+
- '-'
|
21
|
+
- '-'
|
22
22
|
- --
|
23
23
|
- --
|
24
24
|
- '||'
|
@@ -50,7 +50,7 @@
|
|
50
50
|
- '%0'
|
51
51
|
- '%00'
|
52
52
|
- "'"
|
53
|
-
- "'
|
53
|
+
- '"'
|
54
54
|
- "'''"
|
55
55
|
- '`'
|
56
56
|
- '``'
|
@@ -60,7 +60,7 @@
|
|
60
60
|
- '>'
|
61
61
|
- '*'
|
62
62
|
- '!!'
|
63
|
-
- '
|
63
|
+
- '?!'
|
64
64
|
- -
|
65
65
|
- _
|
66
66
|
- -
|
@@ -77,9 +77,12 @@
|
|
77
77
|
- PP
|
78
78
|
- '(]'
|
79
79
|
- '[)'
|
80
|
+
- '*'
|
81
|
+
- ';'
|
80
82
|
- '[?]'
|
81
83
|
- '[?]'
|
82
84
|
- '[?]'
|
85
|
+
- '~'
|
83
86
|
- '[?]'
|
84
87
|
- '[?]'
|
85
88
|
- '[?]'
|
@@ -92,10 +95,7 @@
|
|
92
95
|
- '[?]'
|
93
96
|
- '[?]'
|
94
97
|
- '[?]'
|
95
|
-
- '
|
96
|
-
- '[?]'
|
97
|
-
- '[?]'
|
98
|
-
- '[?]'
|
98
|
+
- ''
|
99
99
|
- '[?]'
|
100
100
|
- '[?]'
|
101
101
|
- '[?]'
|
@@ -1,56 +1,56 @@
|
|
1
1
|
---
|
2
2
|
- ''
|
3
3
|
- ''
|
4
|
+
- C
|
4
5
|
- ''
|
5
6
|
- ''
|
6
7
|
- ''
|
7
8
|
- ''
|
9
|
+
- E
|
8
10
|
- ''
|
9
11
|
- ''
|
10
12
|
- ''
|
13
|
+
- H
|
14
|
+
- H
|
15
|
+
- H
|
11
16
|
- ''
|
12
17
|
- ''
|
18
|
+
- I
|
19
|
+
- I
|
20
|
+
- L
|
13
21
|
- ''
|
14
22
|
- ''
|
23
|
+
- N
|
15
24
|
- ''
|
16
25
|
- ''
|
17
26
|
- ''
|
27
|
+
- P
|
28
|
+
- Q
|
29
|
+
- R
|
30
|
+
- R
|
31
|
+
- R
|
18
32
|
- ''
|
19
33
|
- ''
|
20
34
|
- ''
|
21
35
|
- ''
|
22
36
|
- ''
|
23
37
|
- ''
|
38
|
+
- Z
|
24
39
|
- ''
|
25
40
|
- ''
|
26
41
|
- ''
|
42
|
+
- Z
|
27
43
|
- ''
|
44
|
+
- K
|
28
45
|
- ''
|
46
|
+
- B
|
47
|
+
- C
|
29
48
|
- ''
|
30
49
|
- ''
|
50
|
+
- E
|
51
|
+
- F
|
31
52
|
- ''
|
32
|
-
-
|
33
|
-
- ''
|
34
|
-
- ''
|
35
|
-
- ''
|
36
|
-
- ''
|
37
|
-
- ''
|
38
|
-
- ''
|
39
|
-
- ''
|
40
|
-
- ''
|
41
|
-
- ''
|
42
|
-
- ''
|
43
|
-
- ''
|
44
|
-
- ''
|
45
|
-
- ''
|
46
|
-
- ''
|
47
|
-
- ''
|
48
|
-
- ''
|
49
|
-
- ''
|
50
|
-
- ''
|
51
|
-
- ''
|
52
|
-
- ''
|
53
|
-
- ''
|
53
|
+
- M
|
54
54
|
- ''
|
55
55
|
- ''
|
56
56
|
- ''
|
@@ -17,8 +17,12 @@
|
|
17
17
|
- '[?]'
|
18
18
|
- '[?]'
|
19
19
|
- '[?]'
|
20
|
+
- '-'
|
20
21
|
- '[?]'
|
21
22
|
- '[?]'
|
23
|
+
- '/'
|
24
|
+
- '\'
|
25
|
+
- *
|
22
26
|
- '[?]'
|
23
27
|
- '[?]'
|
24
28
|
- '[?]'
|
@@ -30,6 +34,7 @@
|
|
30
34
|
- '[?]'
|
31
35
|
- '[?]'
|
32
36
|
- '[?]'
|
37
|
+
- '|'
|
33
38
|
- '[?]'
|
34
39
|
- '[?]'
|
35
40
|
- '[?]'
|
@@ -48,18 +53,13 @@
|
|
48
53
|
- '[?]'
|
49
54
|
- '[?]'
|
50
55
|
- '[?]'
|
56
|
+
- ':'
|
51
57
|
- '[?]'
|
52
58
|
- '[?]'
|
53
59
|
- '[?]'
|
54
60
|
- '[?]'
|
55
61
|
- '[?]'
|
56
|
-
- '
|
57
|
-
- '[?]'
|
58
|
-
- '[?]'
|
59
|
-
- '[?]'
|
60
|
-
- '[?]'
|
61
|
-
- '[?]'
|
62
|
-
- '[?]'
|
62
|
+
- '~'
|
63
63
|
- '[?]'
|
64
64
|
- '[?]'
|
65
65
|
- '[?]'
|
@@ -48,6 +48,7 @@
|
|
48
48
|
- ''
|
49
49
|
- ''
|
50
50
|
- ''
|
51
|
+
- '*'
|
51
52
|
- ''
|
52
53
|
- ''
|
53
54
|
- ''
|
@@ -86,8 +87,7 @@
|
|
86
87
|
- ''
|
87
88
|
- ''
|
88
89
|
- ''
|
89
|
-
- ''
|
90
|
-
- ''
|
90
|
+
- '|'
|
91
91
|
- ''
|
92
92
|
- ''
|
93
93
|
- ''
|
@@ -97,7 +97,7 @@
|
|
97
97
|
- '[?]'
|
98
98
|
- '[?]'
|
99
99
|
- ''
|
100
|
-
- ''
|
100
|
+
- '!'
|
101
101
|
- ''
|
102
102
|
- ''
|
103
103
|
- ''
|
@@ -231,8 +231,8 @@
|
|
231
231
|
- '[?]'
|
232
232
|
- '[?]'
|
233
233
|
- '[?]'
|
234
|
-
- '
|
235
|
-
- '
|
234
|
+
- '<'
|
235
|
+
- '>'
|
236
236
|
- '[?]'
|
237
237
|
- '[?]'
|
238
238
|
- '[?]'
|
data/lib/stringex.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'lucky_sneaks/acts_as_url'
|
2
1
|
require 'lucky_sneaks/string_extensions'
|
3
2
|
require 'lucky_sneaks/unidecoder'
|
4
3
|
|
5
4
|
String.send :include, LuckySneaks::StringExtensions
|
6
5
|
|
7
6
|
if defined?(ActiveRecord)
|
7
|
+
require 'lucky_sneaks/acts_as_url'
|
8
8
|
ActiveRecord::Base.send :include, LuckySneaks::ActsAsUrl
|
9
9
|
end
|
data/test/acts_as_url_test.rb
CHANGED
@@ -8,6 +8,7 @@ rescue LoadError
|
|
8
8
|
require 'active_record'
|
9
9
|
|
10
10
|
RAILS_ROOT = File.dirname(__FILE__)
|
11
|
+
$: << File.join(File.dirname(__FILE__), '../lib')
|
11
12
|
end
|
12
13
|
|
13
14
|
require File.join(File.dirname(__FILE__), '../init')
|
@@ -19,7 +20,11 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
19
20
|
create_table :documents, :force => true do |t|
|
20
21
|
t.string :title, :url, :other
|
21
22
|
end
|
22
|
-
|
23
|
+
|
24
|
+
create_table :updateuments, :force => true do |t|
|
25
|
+
t.string :title, :url, :other
|
26
|
+
end
|
27
|
+
|
23
28
|
create_table :mocuments, :force => true do |t|
|
24
29
|
t.string :title, :url, :other
|
25
30
|
end
|
@@ -27,10 +32,14 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
27
32
|
create_table :permuments, :force => true do |t|
|
28
33
|
t.string :title, :permalink, :other
|
29
34
|
end
|
30
|
-
|
35
|
+
|
31
36
|
create_table :procuments, :force => true do |t|
|
32
37
|
t.string :title, :url, :other
|
33
38
|
end
|
39
|
+
|
40
|
+
create_table :blankuments, :force => true do |t|
|
41
|
+
t.string :title, :url, :other
|
42
|
+
end
|
34
43
|
end
|
35
44
|
ActiveRecord::Migration.verbose = true
|
36
45
|
|
@@ -38,6 +47,10 @@ class Document < ActiveRecord::Base
|
|
38
47
|
acts_as_url :title
|
39
48
|
end
|
40
49
|
|
50
|
+
class Updateument < ActiveRecord::Base
|
51
|
+
acts_as_url :title, :sync_url => true
|
52
|
+
end
|
53
|
+
|
41
54
|
class Mocument < ActiveRecord::Base
|
42
55
|
acts_as_url :title, :scope => :other, :sync_url => true
|
43
56
|
end
|
@@ -54,6 +67,10 @@ class Procument < ActiveRecord::Base
|
|
54
67
|
end
|
55
68
|
end
|
56
69
|
|
70
|
+
class Blankument < ActiveRecord::Base
|
71
|
+
acts_as_url :title, :only_when_blank => true
|
72
|
+
end
|
73
|
+
|
57
74
|
class ActsAsUrlTest < Test::Unit::TestCase
|
58
75
|
def test_should_create_url
|
59
76
|
@doc = Document.create(:title => "Let's Make a Test Title, <em>Okay</em>?")
|
@@ -65,7 +82,7 @@ class ActsAsUrlTest < Test::Unit::TestCase
|
|
65
82
|
@other_doc = Document.create!(:title => "Unique")
|
66
83
|
assert_equal "unique-1", @other_doc.url
|
67
84
|
end
|
68
|
-
|
85
|
+
|
69
86
|
def test_should_not_succ_on_repeated_saves
|
70
87
|
@doc = Document.new(:title => "Continuous or Constant")
|
71
88
|
5.times do
|
@@ -73,6 +90,24 @@ class ActsAsUrlTest < Test::Unit::TestCase
|
|
73
90
|
assert_equal "continuous-or-constant", @doc.url
|
74
91
|
end
|
75
92
|
end
|
93
|
+
|
94
|
+
def test_should_create_unique_url_and_not_clobber_if_another_exists
|
95
|
+
@doc = Updateument.create!(:title => "Unique")
|
96
|
+
@other_doc = Updateument.create!(:title => "Unique")
|
97
|
+
@doc.update_attributes :other => "foo"
|
98
|
+
|
99
|
+
@doc2 = Document.create!(:title => "twonique")
|
100
|
+
@other_doc2 = Document.create!(:title => "twonique")
|
101
|
+
@doc2.update_attributes(:other => "foo")
|
102
|
+
|
103
|
+
assert_equal "unique", @doc.url
|
104
|
+
assert_equal "foo", @doc.other
|
105
|
+
assert_equal "unique-1", @other_doc.url
|
106
|
+
|
107
|
+
assert_equal "twonique", @doc2.url
|
108
|
+
assert_equal "foo", @doc2.other
|
109
|
+
assert_equal "twonique-1", @other_doc2.url
|
110
|
+
end
|
76
111
|
|
77
112
|
def test_should_scope_uniqueness
|
78
113
|
@moc = Mocument.create!(:title => "Mocumentary", :other => "I dunno why but I don't care if I'm unique")
|
@@ -105,6 +140,14 @@ class ActsAsUrlTest < Test::Unit::TestCase
|
|
105
140
|
assert_not_equal @original_url, @moc.url
|
106
141
|
end
|
107
142
|
|
143
|
+
def test_should_update_url_only_when_blank_if_asked
|
144
|
+
@original_url = 'the-url-of-concrete'
|
145
|
+
@blank = Blankument.create!(:title => "Stable as Stone", :url => @original_url)
|
146
|
+
assert_equal @original_url, @blank.url
|
147
|
+
@blank = Blankument.create!(:title => "Stable as Stone")
|
148
|
+
assert_equal 'stable-as-stone', @blank.url
|
149
|
+
end
|
150
|
+
|
108
151
|
def test_should_mass_initialize_urls
|
109
152
|
@doc_1 = Document.create!(:title => "Initial")
|
110
153
|
@doc_2 = Document.create!(:title => "Subsequent")
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "test/unit"
|
2
2
|
|
3
|
+
$: << File.join(File.dirname(__FILE__), '../lib')
|
3
4
|
require File.join(File.dirname(__FILE__), "../init")
|
4
5
|
|
5
6
|
class StringExtensionsTest < Test::Unit::TestCase
|
@@ -15,7 +16,7 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
15
16
|
}.each do |plain, html|
|
16
17
|
assert_equal html, plain.to_html
|
17
18
|
end
|
18
|
-
rescue
|
19
|
+
rescue LoadError
|
19
20
|
puts "\n>> Could not load RedCloth. String#to_html was not tested.\n>> Please gem install RedCloth if you'd like to use this functionality."
|
20
21
|
end
|
21
22
|
|
@@ -28,7 +29,7 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
28
29
|
}.each do |plain, html|
|
29
30
|
assert_equal html, plain.to_html(:lite)
|
30
31
|
end
|
31
|
-
rescue
|
32
|
+
rescue LoadError
|
32
33
|
puts "\n>> Could not load RedCloth. String#to_html (with :lite argument) was not tested.\n>> Please gem install RedCloth if you'd like to use this functionality."
|
33
34
|
end
|
34
35
|
|
@@ -107,7 +108,10 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
107
108
|
"Foo & bar make foobar" => "Foo and bar make foobar",
|
108
109
|
"Breakdown #9" => "Breakdown number 9",
|
109
110
|
"foo@bar.com" => "foo at bar dot com",
|
110
|
-
"100% of yr love" => "100 percent of yr love"
|
111
|
+
"100% of yr love" => "100 percent of yr love",
|
112
|
+
"Kisses are $3.25 each" => "Kisses are 3 dollars 25 cents each",
|
113
|
+
"That CD is £3.25 plus tax" => "That CD is 3 pounds 25 pence plus tax",
|
114
|
+
"This CD is ¥1000 instead" => "This CD is 1000 yen instead"
|
111
115
|
}.each do |misc, plain|
|
112
116
|
assert_equal plain, misc.convert_misc_characters
|
113
117
|
end
|
data/test/unidecoder_test.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "test/unit"
|
2
2
|
|
3
|
+
$: << File.join(File.dirname(__FILE__), '../lib')
|
3
4
|
require File.join(File.dirname(__FILE__), "../init")
|
4
5
|
|
5
6
|
class UnidecoderTest < Test::Unit::TestCase
|
@@ -45,15 +46,15 @@ class UnidecoderTest < Test::Unit::TestCase
|
|
45
46
|
"我能吞下玻璃而不伤身体。" => # Chinese
|
46
47
|
"Wo Neng Tun Xia Bo Li Er Bu Shang Shen Ti . ",
|
47
48
|
"私はガラスを食べられます。それは私を傷つけません。" => # Japanese
|
48
|
-
"Si hagarasuwoShi beraremasu. sorehaSi woShang tukemasen. "
|
49
|
+
"Si hagarasuwoShi beraremasu. sorehaSi woShang tukemasen. "
|
49
50
|
}
|
50
51
|
|
51
|
-
def
|
52
|
+
def test_unidecoder_decode
|
52
53
|
DONT_CONVERT.each do |ascii|
|
53
|
-
assert_equal ascii, LuckySneaks::Unidecoder
|
54
|
+
assert_equal ascii, LuckySneaks::Unidecoder.decode(ascii)
|
54
55
|
end
|
55
56
|
CONVERT_PAIRS.each do |unicode, ascii|
|
56
|
-
assert_equal ascii, LuckySneaks::Unidecoder
|
57
|
+
assert_equal ascii, LuckySneaks::Unidecoder.decode(unicode)
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
@@ -65,4 +66,25 @@ class UnidecoderTest < Test::Unit::TestCase
|
|
65
66
|
assert_equal ascii, unicode.to_ascii
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
def test_unidecoder_encode
|
71
|
+
{
|
72
|
+
# Strings
|
73
|
+
"0041" => "A",
|
74
|
+
"00e6" => "æ",
|
75
|
+
"042f" => "Я"
|
76
|
+
}.each do |codepoint, unicode|
|
77
|
+
assert_equal unicode, LuckySneaks::Unidecoder.encode(codepoint)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_unidecoder_in_yaml_file
|
82
|
+
{
|
83
|
+
"A" => "x00.yml (line 67)",
|
84
|
+
"π" => "x03.yml (line 194)",
|
85
|
+
"Я" => "x04.yml (line 49)"
|
86
|
+
}.each do |character, output|
|
87
|
+
assert_equal output, LuckySneaks::Unidecoder.in_yaml_file(character)
|
88
|
+
end
|
89
|
+
end
|
68
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsl-stringex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Norris
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-07-20 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,12 +23,10 @@ extra_rdoc_files:
|
|
23
23
|
- MIT-LICENSE
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
|
-
- init.rb
|
27
26
|
- MIT-LICENSE
|
28
|
-
- Rakefile
|
29
27
|
- README.rdoc
|
30
|
-
-
|
31
|
-
-
|
28
|
+
- Rakefile
|
29
|
+
- init.rb
|
32
30
|
- lib/lucky_sneaks/acts_as_url.rb
|
33
31
|
- lib/lucky_sneaks/string_extensions.rb
|
34
32
|
- lib/lucky_sneaks/unidecoder.rb
|
@@ -212,6 +210,7 @@ files:
|
|
212
210
|
- lib/lucky_sneaks/unidecoder_data/xfd.yml
|
213
211
|
- lib/lucky_sneaks/unidecoder_data/xfe.yml
|
214
212
|
- lib/lucky_sneaks/unidecoder_data/xff.yml
|
213
|
+
- lib/stringex.rb
|
215
214
|
has_rdoc: true
|
216
215
|
homepage: http://github.com/rsl/stringex
|
217
216
|
post_install_message:
|
@@ -240,7 +239,7 @@ requirements: []
|
|
240
239
|
rubyforge_project:
|
241
240
|
rubygems_version: 1.2.0
|
242
241
|
signing_key:
|
243
|
-
specification_version:
|
242
|
+
specification_version: 3
|
244
243
|
summary: "Some [hopefully] useful extensions to Ruby\xE2\x80\x99s String class"
|
245
244
|
test_files:
|
246
245
|
- test/acts_as_url_test.rb
|
data/stringex.gemspec
DELETED
@@ -1,209 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "stringex"
|
3
|
-
s.version = "0.9.3"
|
4
|
-
s.date = "2008-10-10"
|
5
|
-
s.summary = "Some [hopefully] useful extensions to Ruby’s String class"
|
6
|
-
s.email = "rsl@luckysneaks.com"
|
7
|
-
s.homepage = "http://github.com/rsl/stringex"
|
8
|
-
s.description = "Some [hopefully] useful extensions to Ruby’s String class. Stringex is made up of three libraries: ActsAsUrl [permalink solution with better character translation], Unidecoder [Unicode to Ascii transliteration], and StringExtensions [miscellaneous helper methods for the String class]."
|
9
|
-
s.has_rdoc = true
|
10
|
-
s.authors = "Russell Norris"
|
11
|
-
s.files = %w{
|
12
|
-
init.rb
|
13
|
-
MIT-LICENSE
|
14
|
-
Rakefile
|
15
|
-
README.rdoc
|
16
|
-
stringex.gemspec
|
17
|
-
lib/stringex.rb
|
18
|
-
lib/lucky_sneaks/acts_as_url.rb
|
19
|
-
lib/lucky_sneaks/string_extensions.rb
|
20
|
-
lib/lucky_sneaks/unidecoder.rb
|
21
|
-
lib/lucky_sneaks/unidecoder_data/x00.yml
|
22
|
-
lib/lucky_sneaks/unidecoder_data/x01.yml
|
23
|
-
lib/lucky_sneaks/unidecoder_data/x02.yml
|
24
|
-
lib/lucky_sneaks/unidecoder_data/x03.yml
|
25
|
-
lib/lucky_sneaks/unidecoder_data/x04.yml
|
26
|
-
lib/lucky_sneaks/unidecoder_data/x05.yml
|
27
|
-
lib/lucky_sneaks/unidecoder_data/x06.yml
|
28
|
-
lib/lucky_sneaks/unidecoder_data/x07.yml
|
29
|
-
lib/lucky_sneaks/unidecoder_data/x09.yml
|
30
|
-
lib/lucky_sneaks/unidecoder_data/x0a.yml
|
31
|
-
lib/lucky_sneaks/unidecoder_data/x0b.yml
|
32
|
-
lib/lucky_sneaks/unidecoder_data/x0c.yml
|
33
|
-
lib/lucky_sneaks/unidecoder_data/x0d.yml
|
34
|
-
lib/lucky_sneaks/unidecoder_data/x0e.yml
|
35
|
-
lib/lucky_sneaks/unidecoder_data/x0f.yml
|
36
|
-
lib/lucky_sneaks/unidecoder_data/x10.yml
|
37
|
-
lib/lucky_sneaks/unidecoder_data/x11.yml
|
38
|
-
lib/lucky_sneaks/unidecoder_data/x12.yml
|
39
|
-
lib/lucky_sneaks/unidecoder_data/x13.yml
|
40
|
-
lib/lucky_sneaks/unidecoder_data/x14.yml
|
41
|
-
lib/lucky_sneaks/unidecoder_data/x15.yml
|
42
|
-
lib/lucky_sneaks/unidecoder_data/x16.yml
|
43
|
-
lib/lucky_sneaks/unidecoder_data/x17.yml
|
44
|
-
lib/lucky_sneaks/unidecoder_data/x18.yml
|
45
|
-
lib/lucky_sneaks/unidecoder_data/x1e.yml
|
46
|
-
lib/lucky_sneaks/unidecoder_data/x1f.yml
|
47
|
-
lib/lucky_sneaks/unidecoder_data/x20.yml
|
48
|
-
lib/lucky_sneaks/unidecoder_data/x21.yml
|
49
|
-
lib/lucky_sneaks/unidecoder_data/x22.yml
|
50
|
-
lib/lucky_sneaks/unidecoder_data/x23.yml
|
51
|
-
lib/lucky_sneaks/unidecoder_data/x24.yml
|
52
|
-
lib/lucky_sneaks/unidecoder_data/x25.yml
|
53
|
-
lib/lucky_sneaks/unidecoder_data/x26.yml
|
54
|
-
lib/lucky_sneaks/unidecoder_data/x27.yml
|
55
|
-
lib/lucky_sneaks/unidecoder_data/x28.yml
|
56
|
-
lib/lucky_sneaks/unidecoder_data/x2e.yml
|
57
|
-
lib/lucky_sneaks/unidecoder_data/x2f.yml
|
58
|
-
lib/lucky_sneaks/unidecoder_data/x30.yml
|
59
|
-
lib/lucky_sneaks/unidecoder_data/x31.yml
|
60
|
-
lib/lucky_sneaks/unidecoder_data/x32.yml
|
61
|
-
lib/lucky_sneaks/unidecoder_data/x33.yml
|
62
|
-
lib/lucky_sneaks/unidecoder_data/x4d.yml
|
63
|
-
lib/lucky_sneaks/unidecoder_data/x4e.yml
|
64
|
-
lib/lucky_sneaks/unidecoder_data/x4f.yml
|
65
|
-
lib/lucky_sneaks/unidecoder_data/x50.yml
|
66
|
-
lib/lucky_sneaks/unidecoder_data/x51.yml
|
67
|
-
lib/lucky_sneaks/unidecoder_data/x52.yml
|
68
|
-
lib/lucky_sneaks/unidecoder_data/x53.yml
|
69
|
-
lib/lucky_sneaks/unidecoder_data/x54.yml
|
70
|
-
lib/lucky_sneaks/unidecoder_data/x55.yml
|
71
|
-
lib/lucky_sneaks/unidecoder_data/x56.yml
|
72
|
-
lib/lucky_sneaks/unidecoder_data/x57.yml
|
73
|
-
lib/lucky_sneaks/unidecoder_data/x58.yml
|
74
|
-
lib/lucky_sneaks/unidecoder_data/x59.yml
|
75
|
-
lib/lucky_sneaks/unidecoder_data/x5a.yml
|
76
|
-
lib/lucky_sneaks/unidecoder_data/x5b.yml
|
77
|
-
lib/lucky_sneaks/unidecoder_data/x5c.yml
|
78
|
-
lib/lucky_sneaks/unidecoder_data/x5d.yml
|
79
|
-
lib/lucky_sneaks/unidecoder_data/x5e.yml
|
80
|
-
lib/lucky_sneaks/unidecoder_data/x5f.yml
|
81
|
-
lib/lucky_sneaks/unidecoder_data/x60.yml
|
82
|
-
lib/lucky_sneaks/unidecoder_data/x61.yml
|
83
|
-
lib/lucky_sneaks/unidecoder_data/x62.yml
|
84
|
-
lib/lucky_sneaks/unidecoder_data/x63.yml
|
85
|
-
lib/lucky_sneaks/unidecoder_data/x64.yml
|
86
|
-
lib/lucky_sneaks/unidecoder_data/x65.yml
|
87
|
-
lib/lucky_sneaks/unidecoder_data/x66.yml
|
88
|
-
lib/lucky_sneaks/unidecoder_data/x67.yml
|
89
|
-
lib/lucky_sneaks/unidecoder_data/x68.yml
|
90
|
-
lib/lucky_sneaks/unidecoder_data/x69.yml
|
91
|
-
lib/lucky_sneaks/unidecoder_data/x6a.yml
|
92
|
-
lib/lucky_sneaks/unidecoder_data/x6b.yml
|
93
|
-
lib/lucky_sneaks/unidecoder_data/x6c.yml
|
94
|
-
lib/lucky_sneaks/unidecoder_data/x6d.yml
|
95
|
-
lib/lucky_sneaks/unidecoder_data/x6e.yml
|
96
|
-
lib/lucky_sneaks/unidecoder_data/x6f.yml
|
97
|
-
lib/lucky_sneaks/unidecoder_data/x70.yml
|
98
|
-
lib/lucky_sneaks/unidecoder_data/x71.yml
|
99
|
-
lib/lucky_sneaks/unidecoder_data/x72.yml
|
100
|
-
lib/lucky_sneaks/unidecoder_data/x73.yml
|
101
|
-
lib/lucky_sneaks/unidecoder_data/x74.yml
|
102
|
-
lib/lucky_sneaks/unidecoder_data/x75.yml
|
103
|
-
lib/lucky_sneaks/unidecoder_data/x76.yml
|
104
|
-
lib/lucky_sneaks/unidecoder_data/x77.yml
|
105
|
-
lib/lucky_sneaks/unidecoder_data/x78.yml
|
106
|
-
lib/lucky_sneaks/unidecoder_data/x79.yml
|
107
|
-
lib/lucky_sneaks/unidecoder_data/x7a.yml
|
108
|
-
lib/lucky_sneaks/unidecoder_data/x7b.yml
|
109
|
-
lib/lucky_sneaks/unidecoder_data/x7c.yml
|
110
|
-
lib/lucky_sneaks/unidecoder_data/x7d.yml
|
111
|
-
lib/lucky_sneaks/unidecoder_data/x7e.yml
|
112
|
-
lib/lucky_sneaks/unidecoder_data/x7f.yml
|
113
|
-
lib/lucky_sneaks/unidecoder_data/x80.yml
|
114
|
-
lib/lucky_sneaks/unidecoder_data/x81.yml
|
115
|
-
lib/lucky_sneaks/unidecoder_data/x82.yml
|
116
|
-
lib/lucky_sneaks/unidecoder_data/x83.yml
|
117
|
-
lib/lucky_sneaks/unidecoder_data/x84.yml
|
118
|
-
lib/lucky_sneaks/unidecoder_data/x85.yml
|
119
|
-
lib/lucky_sneaks/unidecoder_data/x86.yml
|
120
|
-
lib/lucky_sneaks/unidecoder_data/x87.yml
|
121
|
-
lib/lucky_sneaks/unidecoder_data/x88.yml
|
122
|
-
lib/lucky_sneaks/unidecoder_data/x89.yml
|
123
|
-
lib/lucky_sneaks/unidecoder_data/x8a.yml
|
124
|
-
lib/lucky_sneaks/unidecoder_data/x8b.yml
|
125
|
-
lib/lucky_sneaks/unidecoder_data/x8c.yml
|
126
|
-
lib/lucky_sneaks/unidecoder_data/x8d.yml
|
127
|
-
lib/lucky_sneaks/unidecoder_data/x8e.yml
|
128
|
-
lib/lucky_sneaks/unidecoder_data/x8f.yml
|
129
|
-
lib/lucky_sneaks/unidecoder_data/x90.yml
|
130
|
-
lib/lucky_sneaks/unidecoder_data/x91.yml
|
131
|
-
lib/lucky_sneaks/unidecoder_data/x92.yml
|
132
|
-
lib/lucky_sneaks/unidecoder_data/x93.yml
|
133
|
-
lib/lucky_sneaks/unidecoder_data/x94.yml
|
134
|
-
lib/lucky_sneaks/unidecoder_data/x95.yml
|
135
|
-
lib/lucky_sneaks/unidecoder_data/x96.yml
|
136
|
-
lib/lucky_sneaks/unidecoder_data/x97.yml
|
137
|
-
lib/lucky_sneaks/unidecoder_data/x98.yml
|
138
|
-
lib/lucky_sneaks/unidecoder_data/x99.yml
|
139
|
-
lib/lucky_sneaks/unidecoder_data/x9a.yml
|
140
|
-
lib/lucky_sneaks/unidecoder_data/x9b.yml
|
141
|
-
lib/lucky_sneaks/unidecoder_data/x9c.yml
|
142
|
-
lib/lucky_sneaks/unidecoder_data/x9d.yml
|
143
|
-
lib/lucky_sneaks/unidecoder_data/x9e.yml
|
144
|
-
lib/lucky_sneaks/unidecoder_data/x9f.yml
|
145
|
-
lib/lucky_sneaks/unidecoder_data/xa0.yml
|
146
|
-
lib/lucky_sneaks/unidecoder_data/xa1.yml
|
147
|
-
lib/lucky_sneaks/unidecoder_data/xa2.yml
|
148
|
-
lib/lucky_sneaks/unidecoder_data/xa3.yml
|
149
|
-
lib/lucky_sneaks/unidecoder_data/xa4.yml
|
150
|
-
lib/lucky_sneaks/unidecoder_data/xac.yml
|
151
|
-
lib/lucky_sneaks/unidecoder_data/xad.yml
|
152
|
-
lib/lucky_sneaks/unidecoder_data/xae.yml
|
153
|
-
lib/lucky_sneaks/unidecoder_data/xaf.yml
|
154
|
-
lib/lucky_sneaks/unidecoder_data/xb0.yml
|
155
|
-
lib/lucky_sneaks/unidecoder_data/xb1.yml
|
156
|
-
lib/lucky_sneaks/unidecoder_data/xb2.yml
|
157
|
-
lib/lucky_sneaks/unidecoder_data/xb3.yml
|
158
|
-
lib/lucky_sneaks/unidecoder_data/xb4.yml
|
159
|
-
lib/lucky_sneaks/unidecoder_data/xb5.yml
|
160
|
-
lib/lucky_sneaks/unidecoder_data/xb6.yml
|
161
|
-
lib/lucky_sneaks/unidecoder_data/xb7.yml
|
162
|
-
lib/lucky_sneaks/unidecoder_data/xb8.yml
|
163
|
-
lib/lucky_sneaks/unidecoder_data/xb9.yml
|
164
|
-
lib/lucky_sneaks/unidecoder_data/xba.yml
|
165
|
-
lib/lucky_sneaks/unidecoder_data/xbb.yml
|
166
|
-
lib/lucky_sneaks/unidecoder_data/xbc.yml
|
167
|
-
lib/lucky_sneaks/unidecoder_data/xbd.yml
|
168
|
-
lib/lucky_sneaks/unidecoder_data/xbe.yml
|
169
|
-
lib/lucky_sneaks/unidecoder_data/xbf.yml
|
170
|
-
lib/lucky_sneaks/unidecoder_data/xc0.yml
|
171
|
-
lib/lucky_sneaks/unidecoder_data/xc1.yml
|
172
|
-
lib/lucky_sneaks/unidecoder_data/xc2.yml
|
173
|
-
lib/lucky_sneaks/unidecoder_data/xc3.yml
|
174
|
-
lib/lucky_sneaks/unidecoder_data/xc4.yml
|
175
|
-
lib/lucky_sneaks/unidecoder_data/xc5.yml
|
176
|
-
lib/lucky_sneaks/unidecoder_data/xc6.yml
|
177
|
-
lib/lucky_sneaks/unidecoder_data/xc7.yml
|
178
|
-
lib/lucky_sneaks/unidecoder_data/xc8.yml
|
179
|
-
lib/lucky_sneaks/unidecoder_data/xc9.yml
|
180
|
-
lib/lucky_sneaks/unidecoder_data/xca.yml
|
181
|
-
lib/lucky_sneaks/unidecoder_data/xcb.yml
|
182
|
-
lib/lucky_sneaks/unidecoder_data/xcc.yml
|
183
|
-
lib/lucky_sneaks/unidecoder_data/xcd.yml
|
184
|
-
lib/lucky_sneaks/unidecoder_data/xce.yml
|
185
|
-
lib/lucky_sneaks/unidecoder_data/xcf.yml
|
186
|
-
lib/lucky_sneaks/unidecoder_data/xd0.yml
|
187
|
-
lib/lucky_sneaks/unidecoder_data/xd1.yml
|
188
|
-
lib/lucky_sneaks/unidecoder_data/xd2.yml
|
189
|
-
lib/lucky_sneaks/unidecoder_data/xd3.yml
|
190
|
-
lib/lucky_sneaks/unidecoder_data/xd4.yml
|
191
|
-
lib/lucky_sneaks/unidecoder_data/xd5.yml
|
192
|
-
lib/lucky_sneaks/unidecoder_data/xd6.yml
|
193
|
-
lib/lucky_sneaks/unidecoder_data/xd7.yml
|
194
|
-
lib/lucky_sneaks/unidecoder_data/xf9.yml
|
195
|
-
lib/lucky_sneaks/unidecoder_data/xfa.yml
|
196
|
-
lib/lucky_sneaks/unidecoder_data/xfb.yml
|
197
|
-
lib/lucky_sneaks/unidecoder_data/xfc.yml
|
198
|
-
lib/lucky_sneaks/unidecoder_data/xfd.yml
|
199
|
-
lib/lucky_sneaks/unidecoder_data/xfe.yml
|
200
|
-
lib/lucky_sneaks/unidecoder_data/xff.yml
|
201
|
-
}
|
202
|
-
s.test_files = %w{
|
203
|
-
test/acts_as_url_test.rb
|
204
|
-
test/string_extensions_test.rb
|
205
|
-
test/unidecoder_test.rb
|
206
|
-
}
|
207
|
-
s.rdoc_options = %w{--main README.rdoc --charset utf-8 --line-numbers}
|
208
|
-
s.extra_rdoc_files = %w{MIT-LICENSE README.rdoc}
|
209
|
-
end
|