darryl_jenks 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0084b60ecdf625c0fd50ff7e132b3697c0d2a9b6
4
- data.tar.gz: af178e92ed86a2c109b0830e7195a30af75e30e7
3
+ metadata.gz: aad539e6921510180fbf0af52b0026636790917d
4
+ data.tar.gz: a62e7050ce2e7071313dab01bed96c408e8f7555
5
5
  SHA512:
6
- metadata.gz: 572d21f133607940ea6680dc945ea5ac796df21fe61780f9187a5bbbf67ebc7c2e94f0e5cc834c145ec0c35daf5da0d4a7de6d560ecbf08f24f3a382f6d93a27
7
- data.tar.gz: c0b5651941a10ef65482ceff83243b97f0f5a04db32bd7b06cbadee15b52b9cd5308efeebfa5d6458b105acf222b794e018f98a1db3f1bac7ed9fde945ea430b
6
+ metadata.gz: 5c35cc49ef302945ffa9bf67eeb27694342d196257f56e49ae0395a91282ce0d99c32ffd76b283fa509883f7f466a952e8f62b3dd836a6ff5f205a32673d3088
7
+ data.tar.gz: 5dafe301091d8c629f1a713dcbb34f1d5070014b69fd029ab6b6d8838b532ceffc6a379828cc97a735b643c6f15cfbdae04d608a517679ba4f21bda551d93c16
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DarrylJenks
2
2
 
3
- TODO: Write a gem description
3
+ Darryl is all about the perms ...... Perm it up!!!!
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,29 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ If you know Darryl, you know Darryl loves his perms. The primary use of
22
+ darryl_jenks is to create permutations of strings based on string patterns
23
+ or regular expressions. The utility is best demonstrated by a demonstration
24
+
25
+ ```ruby
26
+ require 'darryl_jenks'
27
+
28
+ test = ::DarrylJenks::Permutable.new("hello world")
29
+
30
+ # Enumerable from replacement of each " " with a "-"
31
+ test.each_permutation(" ", "-").to_a # => [ "hello world", "hello-world" ]
32
+
33
+ # You can even choose how the non_replacement charater is substituted
34
+ test.each_permutation(" ", "-", :non_replace_substitution => "R").to_a # => ["helloRworld", "hello-world"]
35
+
36
+ # Darryl also has facilities to find substrings
37
+ substring = ::DarrylJenks::SubstringFinder.new(/\b/, "hello")
38
+ substring.substring_indexes # => [0]
39
+
40
+ # Another Example
41
+ substring = ::DarrylJenks::SubstringFinder.new("l", "hello")
42
+ substring.substring_indexes # => [2,3]
43
+ ```
22
44
 
23
45
  ## Contributing
24
46
 
@@ -27,7 +27,7 @@ module DarrylJenks
27
27
  return unless self.key_string.index(permutable_key)
28
28
 
29
29
  permutations = []
30
- split_tokens = self.key_string.split(permutable_key)
30
+ split_tokens = self.key_string.split(permutable_key,-1)
31
31
  # At least a single permutation needs to be present
32
32
  number_of_permutations = [(split_tokens.size - 1), 1].max
33
33
 
@@ -1,3 +1,3 @@
1
1
  module DarrylJenks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -16,6 +16,14 @@ describe ::DarrylJenks::Permutable do
16
16
  it "handles trailing permutable keys" do
17
17
  test = ::DarrylJenks::Permutable.new("hello ")
18
18
  test.each_permutation(" ", "-").to_a.should include("hello ", "hello-")
19
+ test.each_permutation(" ", "-").to_a.should_not include("hello")
19
20
  end
21
+
22
+ it "handles trailing permutable keys after multiple words" do
23
+ test = ::DarrylJenks::Permutable.new("hello world ")
24
+ test.each_permutation(" ", "-").to_a.should include("hello world-", "hello-world-","hello-world ")
25
+ test.each_permutation(" ", "-").to_a.should_not include("hello world")
26
+ end
27
+
20
28
  end
21
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darryl_jenks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-15 00:00:00.000000000 Z
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.0.3
95
+ rubygems_version: 2.2.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Just here to perm it up!