refinements 14.6.0 → 14.6.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +12 -10
- data/lib/refinements/pathname.rb +7 -2
- data/refinements.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d986dc181b2c378adc82cc89841387a47286f58f5a3c87bb94d81d951934ab86
|
|
4
|
+
data.tar.gz: 5e4608408e3f89bf4ed72097deec34b0744b5ac939d837eecbd5b887616b9c83
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a0628a9e07d1550af4e03bb39d80fe0494b429a58fb097095b46e25e93560bc4ff71ee79a4519709e3db6d036e8001f9c78c2551a6d3be38fa9d6ceee31396d
|
|
7
|
+
data.tar.gz: 3cd5c78b4a678c7b826366a8c61fcdab222a45c9b8dd103dd6e6f9529bc923c292181bf8ce698a86a6ac23f5bd17ddc9e707da9537dcc817f661e76c85ef253a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -1136,13 +1136,13 @@ link:https://rubyapi.org/o/Dir.chdir#method-c-chdir[Dir.chdir] for details.
|
|
|
1136
1136
|
|
|
1137
1137
|
[source,ruby]
|
|
1138
1138
|
----
|
|
1139
|
-
current = Pathname.pwd
|
|
1140
|
-
custom = current.join("test").
|
|
1141
|
-
custom.change_dir
|
|
1142
|
-
current.change_dir
|
|
1143
|
-
custom.change_dir { "example" }
|
|
1144
|
-
custom.change_dir { |path| path }
|
|
1145
|
-
Pathname.pwd
|
|
1139
|
+
current = Pathname.pwd # "$HOME/demo" (Present Working Directory)
|
|
1140
|
+
custom = current.join("test").mkpath # Pathname "$HOME/demo/test"
|
|
1141
|
+
custom.change_dir # "$HOME/demo/test" (Present Working Directory)
|
|
1142
|
+
current.change_dir # "$HOME/demo" (Present Working Directory)
|
|
1143
|
+
custom.change_dir { "example" } # "example"
|
|
1144
|
+
custom.change_dir { |path| path } # Pathname "$HOME/demo/test"
|
|
1145
|
+
Pathname.pwd # "$HOME/demo" (Present Working Directory)
|
|
1146
1146
|
----
|
|
1147
1147
|
|
|
1148
1148
|
⚠️ This method is _not thread safe_ and suffers the same issues as found with native `Dir.chdir` functionality because the underlying native call is global. Use with care.
|
|
@@ -1277,6 +1277,8 @@ Pathname("/one/two").exist? # false
|
|
|
1277
1277
|
|
|
1278
1278
|
===== #make_dir
|
|
1279
1279
|
|
|
1280
|
+
⚠️ This method is deprecated and will be removed in the next major release.
|
|
1281
|
+
|
|
1280
1282
|
Provides alternative `#mkdir` behavior by always answering itself (even when directory exists) and
|
|
1281
1283
|
not throwing errors when directory does exist in order to ensure the pathname can be chained.
|
|
1282
1284
|
|
|
@@ -1324,9 +1326,9 @@ not throwing errors when directory does exist in order to ensure the pathname ca
|
|
|
1324
1326
|
|
|
1325
1327
|
[source,ruby]
|
|
1326
1328
|
----
|
|
1327
|
-
Pathname("/test").
|
|
1328
|
-
Pathname("/test").remove_dir
|
|
1329
|
-
Pathname("/test").remove_dir.remove_dir
|
|
1329
|
+
Pathname("/test").mkpath.remove_dir.exist? # false
|
|
1330
|
+
Pathname("/test").remove_dir # Pathname("/test")
|
|
1331
|
+
Pathname("/test").remove_dir.remove_dir # Pathname("/test")
|
|
1330
1332
|
----
|
|
1331
1333
|
|
|
1332
1334
|
===== #rewrite
|
data/lib/refinements/pathname.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Refinements
|
|
|
46
46
|
glob(pattern, flag).select(&:directory?)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def empty = file? ? (truncate(0) and self) : rmtree.
|
|
49
|
+
def empty = file? ? (truncate(0) and self) : rmtree.mkpath
|
|
50
50
|
|
|
51
51
|
def extensions = basename.to_s.split(/(?=\.)+/).tap(&:shift)
|
|
52
52
|
|
|
@@ -59,7 +59,12 @@ module Refinements
|
|
|
59
59
|
self
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def make_dir
|
|
62
|
+
def make_dir
|
|
63
|
+
warn "`#{self.class}##{__method__}` is deprecated, use `mkpath` instead.",
|
|
64
|
+
category: :deprecated
|
|
65
|
+
|
|
66
|
+
mkpath
|
|
67
|
+
end
|
|
63
68
|
|
|
64
69
|
def name = basename extname
|
|
65
70
|
|
data/refinements.gemspec
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: refinements
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 14.6.
|
|
4
|
+
version: 14.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
90
|
version: '0'
|
|
91
91
|
requirements: []
|
|
92
|
-
rubygems_version: 4.0.
|
|
92
|
+
rubygems_version: 4.0.23
|
|
93
93
|
specification_version: 4
|
|
94
94
|
summary: A collection of core object refinements.
|
|
95
95
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|