tagify_string 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/.rbenv-gemsets +1 -0
- data/.rbenv-version +1 -0
- data/lib/tagify_string/core_ext.rb +5 -0
- data/lib/tagify_string/version.rb +1 -1
- data/spec/models/string_spec.rb +4 -0
- metadata +4 -2
data/.rbenv-gemsets
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
tagify_string
|
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p0
|
@@ -25,6 +25,11 @@ String.class_eval do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# The Sonia Clause. Check for all garbage characters. Return an empty string in this case.
|
29
|
+
output = self.gsub("_", "").parameterize(opts[:sep])
|
30
|
+
return "" if output.length == 0
|
31
|
+
|
32
|
+
# Otherwise, attach prefix, process for case and send back.
|
28
33
|
output = [prefix, self].join(" ").parameterize(opts[:sep])
|
29
34
|
opts[:upcase] ? output.upcase : output.downcase
|
30
35
|
end
|
data/spec/models/string_spec.rb
CHANGED
@@ -36,6 +36,10 @@ describe "String" do
|
|
36
36
|
" +a- .,.,, . &&()@, ##b . . c#-d ".tagify.should eq "A-B-C-D"
|
37
37
|
end
|
38
38
|
|
39
|
+
it "returns an empty string if all garbage is presented" do
|
40
|
+
"@%%@+_)(*&^%$@!".tagify.should eq ""
|
41
|
+
end
|
42
|
+
|
39
43
|
context "with a bang" do
|
40
44
|
it "changes the value of the string" do
|
41
45
|
s = "a,b".tagify!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagify_string
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -84,6 +84,8 @@ extensions: []
|
|
84
84
|
extra_rdoc_files: []
|
85
85
|
files:
|
86
86
|
- .gitignore
|
87
|
+
- .rbenv-gemsets
|
88
|
+
- .rbenv-version
|
87
89
|
- .rvmrc
|
88
90
|
- Gemfile
|
89
91
|
- LICENSE.txt
|
@@ -115,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
117
|
version: '0'
|
116
118
|
requirements: []
|
117
119
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.8.
|
120
|
+
rubygems_version: 1.8.23
|
119
121
|
signing_key:
|
120
122
|
specification_version: 3
|
121
123
|
summary: This is reasonably trivial functionality being split off into a gem for the
|