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.
@@ -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
@@ -13,4 +13,8 @@ describe "urlize" do
13
13
  it "should remove all characters except letters, numbers, and dashes" do
14
14
  "A_b C#d!-e".urlize.should == "ab-cd-e"
15
15
  end
16
+
17
+ it "should remove trailing dashes" do
18
+ "X-y-z--".urlize.should == "x-y-z"
19
+ end
16
20
  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.1
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-11 00:00:00 -07:00
12
+ date: 2008-10-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15