wordnik_ruby_helpers 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordnik_ruby_helpers (0.1.5)
4
+ wordnik_ruby_helpers (0.1.6)
5
5
  RedCloth (>= 4.2.3)
6
6
  rails
7
7
 
@@ -0,0 +1,15 @@
1
+ Wordnik Ruby Helpers
2
+ ====================
3
+
4
+ This gem is a collection of view helpers and monkey patches we use in all our wordnik ruby apps.
5
+
6
+
7
+ Installation
8
+ ------------
9
+
10
+ gem install wordnik_ruby_helpers
11
+
12
+ Usage
13
+ -----
14
+
15
+ See [rubydoc.info/github/wordnik/wordnik_ruby_helpers](http://rubydoc.info/github/wordnik/wordnik_ruby_helpers/master/frames)
@@ -192,7 +192,7 @@ class String
192
192
 
193
193
  # Generates a permalink-style string, with odd characters removed, etc.
194
194
  def permalinkify
195
- result = self.to_s
195
+ result = self.dup
196
196
  result.gsub!(/[^\x00-\x7F]+/, '') # Remove anything non-ASCII entirely (e.g. diacritics).
197
197
  result.gsub!(/[^\w_ \-]+/i, '') # Remove unwanted chars.
198
198
  result.gsub!(/[ \-]+/i, '-') # No more than one of the separator in a row.
@@ -200,6 +200,10 @@ class String
200
200
  result.downcase
201
201
  end
202
202
 
203
+ def permalinkify!
204
+ self.replace(self.permalinkify)
205
+ end
206
+
203
207
  # Removes HTML tags from a string
204
208
  def strip_tags
205
209
  self.gsub(/<\/?[^>]*>/, "")
@@ -1,3 +1,3 @@
1
1
  module WordnikRubyHelpers
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -2,6 +2,23 @@ require 'spec_helper'
2
2
 
3
3
  describe WordnikRubyHelpers do
4
4
 
5
+ context "permalinkify" do
6
+
7
+ it "doesn't alter the original object" do
8
+ s1 = "wang dang"
9
+ s2 = s1.permalinkify
10
+ s1.should == "wang dang"
11
+ s2.should == "wang-dang"
12
+ end
13
+
14
+ it "alters the original object when bangy!" do
15
+ s1 = "wang dang"
16
+ s1.permalinkify!
17
+ s1.should == "wang-dang"
18
+ end
19
+
20
+ end
21
+
5
22
  context "tag" do
6
23
 
7
24
  it "works!" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wordnik_ruby_helpers
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.6
5
+ version: 0.1.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zeke Sikelianos
@@ -11,7 +11,8 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-07-22 00:00:00 Z
14
+ date: 2011-08-08 00:00:00 -07:00
15
+ default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: rails
@@ -82,7 +83,7 @@ files:
82
83
  - .gitignore
83
84
  - Gemfile
84
85
  - Gemfile.lock
85
- - README
86
+ - README.md
86
87
  - Rakefile
87
88
  - lib/wordnik_ruby_helpers.rb
88
89
  - lib/wordnik_ruby_helpers/version.rb
@@ -90,6 +91,7 @@ files:
90
91
  - spec/spec_helper.rb
91
92
  - spec/wordnik_ruby_helpers_spec.rb
92
93
  - wordnik_ruby_helpers.gemspec
94
+ has_rdoc: true
93
95
  homepage: http://wordnik.com
94
96
  licenses: []
95
97
 
@@ -113,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
115
  requirements: []
114
116
 
115
117
  rubyforge_project: wordnik_ruby_helpers
116
- rubygems_version: 1.8.5
118
+ rubygems_version: 1.5.1
117
119
  signing_key:
118
120
  specification_version: 3
119
121
  summary: A handful of monkey patches and view helpers that we use in our rails projects
data/README DELETED
File without changes