zeke-monkey_patches 0.1.6 → 0.1.7

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 6
3
+ :patch: 7
4
4
  :major: 0
@@ -1,5 +1,16 @@
1
1
  class String
2
2
 
3
+ # Pollute the space between every letter in a string,
4
+ # so it will be exempt from any impending string searches.
5
+ def pollute(delimiter = "^--^--^")
6
+ self.split('').map{|letter| "#{letter}#{delimiter}" }.join
7
+ end
8
+
9
+ # Meant to be paired with the pollute method, this removes 'pollution' from the string
10
+ def sanitize(delimiter = "^--^--^")
11
+ self.gsub(delimiter, "")
12
+ end
13
+
3
14
  # Removes the middle from long strings, replacing with a placeholder
4
15
  def ellipsize(options={})
5
16
  max = options[:max] || 40
@@ -53,7 +53,17 @@ describe "MonkeyPatches" do
53
53
  it "nixes globally" do
54
54
  "this thing that thing".gnix("thing").should == "this that "
55
55
  end
56
-
56
+
57
+ it "pollutes and sanitizes" do
58
+ s = "test"
59
+ s.pollute.should == "t^--^--^e^--^--^s^--^--^t^--^--^"
60
+ s.sanitize.should == s
61
+ s.pollute.sanitize.should == s
62
+
63
+ s.pollute("-").should == "t-e-s-t-"
64
+ s.sanitize("-").should == s
65
+ s.pollute("-").sanitize("-").should == s
66
+ end
57
67
 
58
68
  # Array specs
59
69
 
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.6
4
+ version: 0.1.7
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-02 00:00:00 -07:00
12
+ date: 2009-04-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15