pathutil 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2810facc8f6d9111a34f28c9d3bbf25c7afd606d
4
- data.tar.gz: b9532b101d646c6adee33d71dc3af17d9324fc36
3
+ metadata.gz: 7adeba9b30c364e3ee44b710c116d6b8f5c1618e
4
+ data.tar.gz: c411f1581b9aa43bb8950b8152996214b0f3d439
5
5
  SHA512:
6
- metadata.gz: 84310cdcec23f271f44216c0a9c8b80c763059bf1ee3725fe03c89ed868e71479bf70fc7894c79bb67afb19e4daec642a449017680fb0532f28ac2f93eb124d4
7
- data.tar.gz: 3dfab086abe1dfb53a451b7b1bb05b72a5a29a1247f9d804b22de0e66832532a87c1b3d3ee3f2308730d0c88a4c6b4f79907585c053f07d0e45700ad19573f95
6
+ metadata.gz: f4098b97bc4f98a84a09dbc229c7ebe0e79577d5606fbc31ca2870268d8ecd905793bfe07d40e2a40ccb3d2cfbef1e2616029e61e4e2d1bf97cae9be8424577c
7
+ data.tar.gz: b906af65d158da1a5cf5178330d3e2cd899e1b74c640c9e59f7372a2b099203d4a677c3b200c11c8a7408f095937c92fdb4e52deccdd4b74a2c079acaa34e602
@@ -107,7 +107,7 @@ class Pathutil
107
107
  # --
108
108
  def split_path
109
109
  @path.split(
110
- /\\+|\/+/.freeze
110
+ %r!\\+|/+!
111
111
  )
112
112
  end
113
113
 
@@ -258,7 +258,7 @@ class Pathutil
258
258
  # @return true|false
259
259
  # --
260
260
  def root?
261
- !!(self =~ /\A(?:[A-Za-z]:)?(?:\\+|\/+)\Z/)
261
+ !!(self =~ %r!\A(?:[A-Za-z]:)?(?:\\+|/+)\z!)
262
262
  end
263
263
 
264
264
  # --
@@ -577,6 +577,10 @@ class Pathutil
577
577
  ))
578
578
  end
579
579
 
580
+ # --
581
+ # rubocop:disable Metrics/AbcSize
582
+ # rubocop:disable Metrics/CyclomaticComplexity
583
+ # rubocop:disable Metrics/PerceivedComplexity
580
584
  # --
581
585
 
582
586
  def aggressive_cleanpath
@@ -604,7 +608,7 @@ class Pathutil
604
608
  # --
605
609
 
606
610
  def conservative_cleanpath
607
- _out = (path = split_path).each_with_object([]) do |(part, i), out|
611
+ _out = split_path.each_with_object([]) do |part, out|
608
612
  next if part == "." || (part == ".." && out.last == "")
609
613
  out.push(
610
614
  part
@@ -621,11 +625,14 @@ class Pathutil
621
625
 
622
626
  return self.class.new("/") if _out == [""].freeze
623
627
  return self.class.new(".") if _out.empty? && (end_with?(".") || relative?)
624
- return self.class.new(_out.join("/")).join("") if @path =~ /\/\z/ && _out.last != "." && _out.last != ".."
628
+ return self.class.new(_out.join("/")).join("") if @path =~ %r!/\z! && _out.last != "." && _out.last != ".."
625
629
  self.class.new(_out.join("/"))
626
630
  end
627
631
 
628
632
  # --
633
+ # rubocop:enable Metrics/AbcSize
634
+ # rubocop:enable Metrics/CyclomaticComplexity
635
+ # rubocop:enable Metrics/PerceivedComplexity
629
636
  # Expand the paths and return.
630
637
  # --
631
638
  private
@@ -20,8 +20,8 @@ class Pathutil
20
20
  # @note We default aliases to yes so we can detect if you explicit true.
21
21
  # @return Hash
22
22
  # --
23
- def load_yaml(data, safe: true, whitelist_classes: self.allowed[:yaml][:classes], \
24
- whitelist_symbols: self.allowed[:yaml][:symbols], aliases: :yes)
23
+ def load_yaml(data, safe: true, whitelist_classes: allowed[:yaml][:classes], \
24
+ whitelist_symbols: allowed[:yaml][:symbols], aliases: :yes)
25
25
 
26
26
  require "yaml"
27
27
  unless safe
@@ -3,5 +3,5 @@
3
3
  # Encoding: utf-8
4
4
 
5
5
  class Pathutil
6
- VERSION = "0.11.0"
6
+ VERSION = "0.12.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pathutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell