diff options
author | Lamont Granquist <lamont@chef.io> | 2020-07-23 17:57:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 17:57:41 -0700 |
commit | 6680baa794c01264ecb1c756f16a66564a1dbab8 (patch) | |
tree | e4c5ee2d233a78760e3b068641aa98c5934f1e19 | |
parent | 4910a85d52b83d5971071ebaaa563beb23343979 (diff) | |
download | chef-6680baa794c01264ecb1c756f16a66564a1dbab8.tar.gz |
Update chef-config/lib/chef-config/path_helper.rb
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Co-authored-by: pete higgins <pete@peterhiggins.org>
-rw-r--r-- | chef-config/lib/chef-config/path_helper.rb | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb index 7c959f71e7..9a7717afd1 100644 --- a/chef-config/lib/chef-config/path_helper.rb +++ b/chef-config/lib/chef-config/path_helper.rb @@ -55,16 +55,7 @@ module ChefConfig end end - def self.path_separator_regex - @path_separator_regex ||= - begin - path_separator_regex = Regexp.escape(File::SEPARATOR) - unless path_separator == File::SEPARATOR - path_separator_regex << Regexp.escape(path_separator) - end - path_separator_regex - end - end + path_seperator_regex = [Regexp.escape(File::SEPARATOR), Regexp.escape(path_separator)].uniq.join TRAILING_SLASHES_REGEX = /[#{path_separator_regex}]+$/.freeze LEADING_SLASHES_REGEX = /^[#{path_separator_regex}]+/.freeze |