ffmike-from_param 1.0.1 → 1.0.2
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/lib/string_extensions.rb +2 -1
- data/spec/string_extensions_spec.rb +4 -0
- metadata +2 -2
data/lib/string_extensions.rb
CHANGED
@@ -4,11 +4,12 @@ class String
|
|
4
4
|
# * Replaces spaces with dashes
|
5
5
|
# * Converts to all lower-case
|
6
6
|
# * Removes all characters except alphabetic and numeric
|
7
|
+
# * Removes any trailing dashes (for ease in urlizing things like "#{name}-#{optional_city}")
|
7
8
|
def urlize
|
8
9
|
if ActiveSupport::Inflector.respond_to?(:parameterize)
|
9
10
|
self.parameterize
|
10
11
|
else
|
11
|
-
self.gsub(" ","-").downcase.gsub(/[^a-z0-9-]/,"")
|
12
|
+
self.gsub(" ","-").downcase.gsub(/[^a-z0-9-]/,"").gsub(/(-)*$/,"")
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffmike-from_param
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|