buzzcore 0.6.2 → 0.6.3
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/VERSION +1 -1
- data/buzzcore.gemspec +1 -1
- data/lib/buzzcore/extend_base_classes.rb +11 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
2
2
|
|
data/buzzcore.gemspec
CHANGED
@@ -103,13 +103,17 @@ String.class_eval do
|
|
103
103
|
aDefault
|
104
104
|
end
|
105
105
|
|
106
|
-
|
106
|
+
# "...Only alphanumerics [0-9a-zA-Z], the special characters "$-_.+!*'()," [not including the quotes - ed], and reserved characters used for their reserved purposes may be used unencoded within a URL."
|
107
|
+
|
108
|
+
URLIZE_SEPARATORS = /[ \\\(\)\[\]\.*,]/ # was /[ \\\(\)\[\]\.*,]/
|
107
109
|
URLIZE_EXTENSIONS = %w(html htm jpg jpeg png gif bmp mov avi mp3 zip pdf css js doc xdoc)
|
108
|
-
|
110
|
+
URLIZE_REMOVE = /[^a-z0-9\_\-+~\/]/ # was 'a-z0-9_-+~/'
|
109
111
|
# aKeepExtensions may be an array of extensions to keep, or :none (will remove periods) or :all (any extension <= 4 chars)
|
110
|
-
def urlize(aSlashChar='+',aKeepExtensions=
|
112
|
+
def urlize(aSlashChar='+',aRemove=nil,aKeepExtensions=nil)
|
113
|
+
aKeepExtensions=URLIZE_EXTENSIONS if !aKeepExtensions
|
114
|
+
aRemove=URLIZE_REMOVE if !aRemove
|
111
115
|
return self if self.empty?
|
112
|
-
result = self.
|
116
|
+
result = self.downcase
|
113
117
|
ext = nil
|
114
118
|
if (aKeepExtensions!=:none) && last_dot = result.rindex('.')
|
115
119
|
if (ext_len = result.length-last_dot-1) <= 4 # preserve extension without dot if <= 4 chars long
|
@@ -118,7 +122,9 @@ String.class_eval do
|
|
118
122
|
result = result[0,last_dot] if ext
|
119
123
|
end
|
120
124
|
end
|
121
|
-
|
125
|
+
|
126
|
+
result = result.gsub(URLIZE_SEPARATORS,'-')
|
127
|
+
result = result.gsub(aRemove,'').sub(/-+$/,'').sub(/^-+/,'')
|
122
128
|
result.gsub!('/',aSlashChar) unless aSlashChar=='/'
|
123
129
|
result.gsub!(/-{2,}/,'-')
|
124
130
|
result += '.'+ext if ext
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buzzcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- buzzware
|