match_skeleton 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/ChangeLog +8 -1
- data/lib/match_skeleton.rb +2 -2
- data/test/test_match_skeleton.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 174be02fe7b1a1d7bc90813667fc844ee63cc5d7
|
4
|
+
data.tar.gz: 07bd14dc31db48d07301f4d4356db6bab79fa69a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6ba17d2747741c4ffd8aca55899320185e9db24e7eddb07a08dde73fd5fb955cd6517cdc2ac61c68df6f87fcbfb737aa883e33fabb9dbdaae25e221e34f5115
|
7
|
+
data.tar.gz: 4cceec801deab65b9c925fd93e16fdedc7e44933a95659332a86c58a012545ab9ebe3d87f816e01f8ee22d90ca44423c63be4e70a5c54e28881e80bb516337de
|
data/ChangeLog
CHANGED
data/lib/match_skeleton.rb
CHANGED
@@ -34,8 +34,8 @@ class MatchSkeleton
|
|
34
34
|
end
|
35
35
|
@string = (string || md.string)
|
36
36
|
@regexp = md.regexp
|
37
|
-
@pre_match = (0
|
38
|
-
@post_match = ((size_str-md.post_match.size)
|
37
|
+
@pre_match = (0...md.pre_match.size) # {Range}
|
38
|
+
@post_match = ((size_str-md.post_match.size)...size_str) # {Range}
|
39
39
|
|
40
40
|
# @offsets is Hash with the keys of both Integer and possibly Symbol
|
41
41
|
# if names exist.
|
data/test/test_match_skeleton.rb
CHANGED
@@ -320,6 +320,22 @@ class TestMatchSkeleton < Minitest::Test
|
|
320
320
|
assert_equal "T", ms1.pre_match
|
321
321
|
end
|
322
322
|
|
323
|
+
def test_pre_match_beg01
|
324
|
+
s = "Beg"
|
325
|
+
md1 = /(.)/.match(s)
|
326
|
+
ms1 = MatchSkeleton.new(md1, s)
|
327
|
+
assert_equal md1.pre_match, ms1.pre_match
|
328
|
+
assert_equal "", ms1.pre_match
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_post_match_end01
|
332
|
+
s = "Beg"
|
333
|
+
md1 = /(.)$/.match(s)
|
334
|
+
ms1 = MatchSkeleton.new(md1, s)
|
335
|
+
assert_equal md1.post_match, ms1.post_match
|
336
|
+
assert_equal "", ms1.post_match
|
337
|
+
end
|
338
|
+
|
323
339
|
def test_size01
|
324
340
|
s = "THX1138."
|
325
341
|
md1 = /(.)(.)(\d+)(\d)/.match(s)
|