xmp2assert 10 → 11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xmp2assert/version.rb +1 -1
- data/lib/xmp2assert/xmp2rexp.rb +6 -1
- 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: 45061563c460b60b3b9b9a9c9cdc08fdd00da562
|
4
|
+
data.tar.gz: 0af4015708d764defe90793c4d3be3fb9e5384d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7e59307031b64e753d3252fb94dd733c820077aaf794320eec65e288bd1166bb52ef9d556d44fb039c150b080a26854e80f3a95df24e6c230ea2b0c3c4f820
|
7
|
+
data.tar.gz: b519801bad8bd7f1193fe5957e9547e9c3d5ee1555d7a5bdd5644578fa8f6ce0f88fd02236c63b5571ef82dfd81afbad9071c947a294292c36dfcca5c91ffada
|
data/lib/xmp2assert/version.rb
CHANGED
data/lib/xmp2assert/xmp2rexp.rb
CHANGED
@@ -48,11 +48,16 @@ module XMP2Assert::XMP2Rexp
|
|
48
48
|
# :NOTE: we are editing regular expressions using regular expressions. In
|
49
49
|
# order to hack this method you must be a seasoned regular expression
|
50
50
|
# craftsperson who can count backslashes at ease.
|
51
|
+
nln = /\n*\z/.match(xmp).to_s.length
|
51
52
|
src = Regexp.escape xmp.strip
|
52
53
|
src.gsub!(/([^\\])(\\n|\\ )+/, '\\1\s+')
|
53
54
|
src.gsub!(/(#<[\w:]+?:)0x[0-9a-f]+/, '\\10x[0-9a-f]+')
|
54
55
|
src.gsub!(/\\\.rb:\d+/, '\\.rb:\d+')
|
55
56
|
|
56
|
-
|
57
|
+
case nln when 0, 1 then
|
58
|
+
return Regexp.new "\\A#{src}\\n?\\z"
|
59
|
+
else
|
60
|
+
return Regexp.new "\\A#{src}\\n{#{nln}}\\z"
|
61
|
+
end
|
57
62
|
end
|
58
63
|
end
|