refinements 12.4.0 → 12.6.0

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: c057c78518a7f1565f3f74b8e21cb5fc3296962d78c5a1d8fbc918190f38ade3
4
- data.tar.gz: 412c9e3dab2f66b7865a26514cf14049655d2192ff8a8d65b4b8ce284c8defb4
3
+ metadata.gz: e32b598b948abb097125834b408d41c1fa4313a671615b89475c101089fbb870
4
+ data.tar.gz: 9fb3a2380ac0effbe2ac0ca5045e736b9730b2c57162c927f3f0577d04e4da81
5
5
  SHA512:
6
- metadata.gz: 268fff03b14061cdd04cb211eca4cf6b6af4479efde7ad112a9ede05d72bf37971e3f5eb9044824c55aa4c6f7bc28e0a6aff714c6fe88cad23ea1328d46c83ae
7
- data.tar.gz: 598d5f3187a960438d2e5532b24f203023026a81f8ad9bb91d97af0ac5323779ca58e5f63e2c0916643e62c1e78e30d608da6dacf13bc46d3a6f061c4727603b
6
+ metadata.gz: dd4fcab10575c3b0933edbf5290b29fbd2498225f40ff038a626d72dda70462f5b24f1ae76f885d7be5134953d050336024de70bdd3d8545010a3fd4d173e4b3
7
+ data.tar.gz: 1c2a09c4a735be01b6d471548a1621f09d75c394c0a6afcea599cce7c812fb9d2ee4e0510ff8e24cd9d0c6110233d1d764bbc0767b81c287b849ab80241eb826
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -1128,6 +1128,19 @@ Answers file name without extension.
1128
1128
  Pathname("example.txt").name # Pathname("example")
1129
1129
  ----
1130
1130
 
1131
+ ===== #puts
1132
+
1133
+ Wraps `#write` by writing content to file with new line and answering itself. Allows you to more easily swap out a `Pathname` object with similar IO objects who support `#puts`: `IO`, `StringIO`, `File`, `Kernel`, and so forth.
1134
+
1135
+ [source,ruby]
1136
+ ----
1137
+ path = Pathname("test.txt").touch
1138
+ path.puts "Test."
1139
+ path.read # "Test.\n"
1140
+
1141
+ Pathname("text.txt").touch.puts("Test.").read # "Test.\n"
1142
+ ----
1143
+
1131
1144
  ===== #relative_parent
1132
1145
 
1133
1146
  Answers relative path from parent directory. This complements: `#relative_path_from`.
@@ -1551,6 +1564,10 @@ a.transmute! c, c: :t # #<struct Struct::A a=1, b=2, c=30>
1551
1564
  a # #<struct Struct::A a=7, b=8, c=30>
1552
1565
  ----
1553
1566
 
1567
+ ===== #with
1568
+
1569
+ An alias of `#merge` and identical in behavior (see `#merge` documentation for details). Allows you to use `Struct` and `Data` objects more interchangeably since they share the same method.
1570
+
1554
1571
  ==== Symbol
1555
1572
 
1556
1573
  ===== #call
@@ -78,6 +78,8 @@ module Refinements
78
78
 
79
79
  def name = basename extname
80
80
 
81
+ def puts(content) = write "#{content}\n"
82
+
81
83
  def relative_parent(root_dir) = relative_path_from(root_dir).parent
82
84
 
83
85
  def remove_dir = exist? ? (rmdir and self) : self
@@ -38,6 +38,8 @@ module Refinements
38
38
  mapping = key_map.invert
39
39
  merge! object.to_h.slice(*mapping.keys).transform_keys!(mapping)
40
40
  end
41
+
42
+ alias_method :with, :merge
41
43
  end
42
44
  end
43
45
  end
data/refinements.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "refinements"
5
- spec.version = "12.4.0"
5
+ spec.version = "12.6.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/refinements"
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: 12.4.0
4
+ version: 12.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-06-01 00:00:00.000000000 Z
38
+ date: 2024-07-13 00:00:00.000000000 Z
39
39
  dependencies: []
40
40
  description:
41
41
  email:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.5.11
94
+ rubygems_version: 3.5.15
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: A collection of core object refinements.
metadata.gz.sig CHANGED
Binary file