fakefs 1.3.1 → 1.3.2

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
  SHA256:
3
- metadata.gz: 0e9d642f0d0255622007821c7433fd416e328aa50dc2308c866d00922db0ae48
4
- data.tar.gz: 3f0a76cbd3f0dbf65bf66be32e54dcbffc33c05be84c74f28136e7e37812066e
3
+ metadata.gz: 05aa1f68c0f9298802a4171ba6b109e53cb2e020b9b6f2973872ce4cc4de6ce1
4
+ data.tar.gz: 566bdaeab08f35a081857a4a76170c6b94f29bf928735f81470a19e4280297e4
5
5
  SHA512:
6
- metadata.gz: f9635356aa39838dfaf30fb3768754edb74073fccba55e348644402ecd14219ffd3252f08910721c6eec0f03a491cbf5c09575016a0656e7bae826c458980692
7
- data.tar.gz: 3be473ee1b024b6927b65fc1b9e1f0a1594e7f45f8da875b25b8897578b611e7ea44c40e5d16d59ee4e31eca7b780c32f07ef28d509179ff70dc723b6db5217e
6
+ metadata.gz: 25dd82ac5d99560aee6642ee5faea80ee35cf0b70610d6b1f7b3e4cd7369c78f9acf9fce6567ad4ae0409c82e388917a220f4acc2637875768df486127491cf9
7
+ data.tar.gz: 8d087e11e9c7ba065bf07b4cff4ff51011ecf903fd830aa5ec51d8dcb2c18ded53c3cfbf38cc8226f7d4f46590bc3868fa902bfcc2011c1e19c1586868a920eb
@@ -63,20 +63,21 @@ module FakeFS
63
63
  def regexp(pattern, find_flags = 0, gave_char_class = false)
64
64
  pattern = pattern.to_s
65
65
 
66
+ # Escape .+?*()$ characters unless already escaped.
66
67
  regex_body =
67
68
  pattern
68
- .gsub('.', '\.')
69
- .gsub('+') { '\+' }
70
- .gsub('?', '.')
71
- .gsub('*', '.*')
72
- .gsub('(', '\(')
73
- .gsub(')', '\)')
74
- .gsub('$', '\$')
75
-
76
- # unless we're expecting character class contructs in regexes, escape all brackets
77
- # since if we're expecting them, the string should already be properly escaped
69
+ .gsub(/(?<!\\)\./, '\.')
70
+ .gsub(/(?<!\\)\+/) { '\+' }
71
+ .gsub(/(?<!\\)\?/, '.')
72
+ .gsub(/(?<!\\)\*/, '.*')
73
+ .gsub(/(?<!\\)\(/, '\(')
74
+ .gsub(/(?<!\\)\)/, '\)')
75
+ .gsub(/(?<!\\)\$/, '\$')
76
+
77
+ # Unless we're expecting character class contructs in regexes, escape all brackets
78
+ # since if we're expecting them, the string should already be properly escaped.
78
79
  unless gave_char_class
79
- regex_body = regex_body.gsub('[', '\[').gsub(']', '\]')
80
+ regex_body = regex_body.gsub(/(?<!\\)([\[\]])/, '\\\\\1')
80
81
  end
81
82
 
82
83
  # This matches nested braces and attempts to do something correct most of the time
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '1.3.1'.freeze
4
+ VERSION = '1.3.2'.freeze
5
5
 
6
6
  def self.to_s
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakefs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-12-29 00:00:00.000000000 Z
15
+ date: 2021-01-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bump