rekey 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rekey.rb +4 -10
- data/lib/rekey/version.rb +1 -1
- data/test/{test_ranges.rb → test_range.rb} +4 -4
- data/test/test_regexp.rb +30 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6c9d60055fe41b5eb0256261b47ddb024c9f59a
|
4
|
+
data.tar.gz: aa50ed7dae9056378b866e0087c47f05924864f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d5f92fec88e352f45cb44a964e18ba305b2ebb2cc7e345e66e712382413791d30d5331499c6bbad6034260de97891b7973a550390d59593a363b3aaea077c9
|
7
|
+
data.tar.gz: 62e709ab09d097bff692620e27ba1f8f32aeb062d517b3c05f19a424d545b4cde05c4bbe33010a2aa911a25af38d1545d5b8ceb4e6fc37bf13a2a87f9e90e79e
|
data/lib/rekey.rb
CHANGED
@@ -91,17 +91,11 @@ module Rekey
|
|
91
91
|
v.send handle, v
|
92
92
|
end
|
93
93
|
elsif v.is_a? Array
|
94
|
-
if handle.is_a?
|
95
|
-
|
96
|
-
|
97
|
-
handle
|
98
|
-
ends.first,
|
99
|
-
ends.last,
|
100
|
-
handle.include?('...') # exclude_end
|
101
|
-
)
|
94
|
+
if handle.is_a? Regexp
|
95
|
+
v.grep handle
|
96
|
+
else
|
97
|
+
v[handle]
|
102
98
|
end
|
103
|
-
|
104
|
-
v[handle]
|
105
99
|
elsif v.is_a? Hash
|
106
100
|
v[handle]
|
107
101
|
else
|
data/lib/rekey/version.rb
CHANGED
@@ -16,28 +16,28 @@ class RekeyRangeTest < Minitest::Test
|
|
16
16
|
[ 1, 2 ],
|
17
17
|
[ 4, 5 ],
|
18
18
|
],
|
19
|
-
@input.rekey(nil,
|
19
|
+
@input.rekey(nil, 0..1)
|
20
20
|
)
|
21
21
|
|
22
22
|
assert_equal([
|
23
23
|
[ 2 ],
|
24
24
|
[ 5 ],
|
25
25
|
],
|
26
|
-
@input.rekey(nil,
|
26
|
+
@input.rekey(nil, 1...2)
|
27
27
|
)
|
28
28
|
|
29
29
|
assert_equal({
|
30
30
|
[ 2 ] => @input[0],
|
31
31
|
[ 5 ] => @input[1],
|
32
32
|
},
|
33
|
-
@input.rekey(
|
33
|
+
@input.rekey(1...2)
|
34
34
|
)
|
35
35
|
|
36
36
|
assert_equal({
|
37
37
|
3 => [ 1, 2 ],
|
38
38
|
6 => [ 4, 5 ],
|
39
39
|
},
|
40
|
-
@input.rekey(2,
|
40
|
+
@input.rekey(2, 0..1)
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
data/test/test_regexp.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'rekey'
|
3
|
+
|
4
|
+
|
5
|
+
class RekeyRegexpTest < Minitest::Test
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@input = [
|
9
|
+
[ 'a', 'aa', 'b', 'ba' ],
|
10
|
+
[ 'b', 'c', 'bc' ],
|
11
|
+
]
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_stuff
|
15
|
+
assert_equal([
|
16
|
+
['a', 'aa', 'ba'],
|
17
|
+
[],
|
18
|
+
],
|
19
|
+
@input.rekey(nil, /a/)
|
20
|
+
)
|
21
|
+
|
22
|
+
assert_equal([
|
23
|
+
['b', 'ba'],
|
24
|
+
['b', 'bc'],
|
25
|
+
],
|
26
|
+
@input.rekey(nil, /b/)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rekey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
@@ -41,7 +41,8 @@ files:
|
|
41
41
|
- test/test_array_handlers.rb
|
42
42
|
- test/test_hash_block.rb
|
43
43
|
- test/test_hash_handlers.rb
|
44
|
-
- test/
|
44
|
+
- test/test_range.rb
|
45
|
+
- test/test_regexp.rb
|
45
46
|
homepage: https://github.com/d1hotpep/rekey
|
46
47
|
licenses:
|
47
48
|
- MIT
|
@@ -71,4 +72,5 @@ test_files:
|
|
71
72
|
- test/test_array_handlers.rb
|
72
73
|
- test/test_hash_block.rb
|
73
74
|
- test/test_hash_handlers.rb
|
74
|
-
- test/
|
75
|
+
- test/test_range.rb
|
76
|
+
- test/test_regexp.rb
|