zeke-monkey_patches 0.1.9 → 0.1.10
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.yml +1 -1
- data/lib/monkey_patches.rb +5 -0
- data/spec/monkey_patches_spec.rb +6 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/monkey_patches.rb
CHANGED
@@ -29,6 +29,11 @@ class String
|
|
29
29
|
result.gsub!(/^\-|\-$/i, '') # Remove leading/trailing separator.
|
30
30
|
result.downcase
|
31
31
|
end
|
32
|
+
|
33
|
+
# Removes HTML tags from a string
|
34
|
+
def strip_tags
|
35
|
+
self.gsub(/<\/?[^>]*>/, "")
|
36
|
+
end
|
32
37
|
|
33
38
|
# Remove first instance of string
|
34
39
|
def nix(string)
|
data/spec/monkey_patches_spec.rb
CHANGED
@@ -46,6 +46,12 @@ describe "MonkeyPatches" do
|
|
46
46
|
"We ‘are’ single".replace_wonky_characters_with_ascii.should == "We 'are' single"
|
47
47
|
end
|
48
48
|
|
49
|
+
it "strips tags" do
|
50
|
+
"whoa".strip_tags.should == "whoa"
|
51
|
+
"<a href='http://shitstorm.com'>click</a>".strip_tags.should == "click"
|
52
|
+
"this is <b>bold</b> and <em>emphatic</em>".strip_tags.should == "this is bold and emphatic"
|
53
|
+
end
|
54
|
+
|
49
55
|
it "nixes" do
|
50
56
|
"this thing that thing".nix("thing").should == "this that thing"
|
51
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeke-monkey_patches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Sikelianos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|