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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ee807aa1f8e0b7050849503c16ac08f4ef6bc3f
4
- data.tar.gz: 36b5a97d0a8e12c5d74924373d4d6accf3198987
3
+ metadata.gz: 174be02fe7b1a1d7bc90813667fc844ee63cc5d7
4
+ data.tar.gz: 07bd14dc31db48d07301f4d4356db6bab79fa69a
5
5
  SHA512:
6
- metadata.gz: 13d436fe8338c8ccd41b6a503b5daa033dab55e6bb66dfab71fb8211a59270acac9cf60b576ed455b36f413e23ad99bd26775ac6b6425b39997668181684c231
7
- data.tar.gz: 66d95d123d62cc28348e681f987e94b664761e73c4ae8cacb578c848270fa17e9cc28c8b22876f71faa495d92191e79046ca2c8943e4d305a9eff028aceabb12
6
+ metadata.gz: b6ba17d2747741c4ffd8aca55899320185e9db24e7eddb07a08dde73fd5fb955cd6517cdc2ac61c68df6f87fcbfb737aa883e33fabb9dbdaae25e221e34f5115
7
+ data.tar.gz: 4cceec801deab65b9c925fd93e16fdedc7e44933a95659332a86c58a012545ab9ebe3d87f816e01f8ee22d90ca44423c63be4e70a5c54e28881e80bb516337de
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
1
  -----
2
- (Version: 0.1.0) 2016-05-19
2
+ (Version: 1.0.1)
3
+ 2016-05-19 Masa Sakano
4
+ * Fixed a bug pre_match behaves incorrectly when the match starts at the beginning of the string.
5
+
6
+ -----
7
+ (Version: 1.0.0)
8
+ 2016-05-19 Masa Sakano
9
+
3
10
  * First creation.
@@ -34,8 +34,8 @@ class MatchSkeleton
34
34
  end
35
35
  @string = (string || md.string)
36
36
  @regexp = md.regexp
37
- @pre_match = (0..(md.pre_match.size-1)) # {Range}
38
- @post_match = ((size_str-md.post_match.size)..(size_str-1)) # {Range}
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.
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: match_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masa Sakano