zeke-monkey_patches 0.1.4 → 0.1.5
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 +2 -2
- data/lib/monkey_patches.rb +10 -0
- data/spec/monkey_patches_spec.rb +9 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/monkey_patches.rb
CHANGED
@@ -19,6 +19,16 @@ class String
|
|
19
19
|
result.downcase!
|
20
20
|
end
|
21
21
|
|
22
|
+
# Remove first instance of string
|
23
|
+
def nix(string)
|
24
|
+
self.sub(string, "")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Remove all instances of string
|
28
|
+
def gnix(string)
|
29
|
+
self.gsub(string, "")
|
30
|
+
end
|
31
|
+
|
22
32
|
# Prepends 'http://' to the beginning of non-empty strings that don't already have it.
|
23
33
|
def add_http
|
24
34
|
return "" if self.blank?
|
data/spec/monkey_patches_spec.rb
CHANGED
@@ -45,6 +45,15 @@ describe "MonkeyPatches" do
|
|
45
45
|
"We ‘are’ single".replace_wonky_characters_with_ascii.should == "We 'are' single"
|
46
46
|
end
|
47
47
|
|
48
|
+
it "nixes" do
|
49
|
+
"this thing that thing".nix("thing").should == "this that thing"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "nixes globally" do
|
53
|
+
"this thing that thing".gnix("thing").should == "this that "
|
54
|
+
end
|
55
|
+
|
56
|
+
|
48
57
|
# Array specs
|
49
58
|
|
50
59
|
it "removes first element" do
|
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.5
|
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-03-
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|