refinements 11.0.0 → 11.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +22 -22
- data/refinements.gemspec +1 -1
- data.tar.gz.sig +3 -3
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efdcd2042bcfde5031fad3d0049e01fc4e1ad23a9d4841ee601fdcb02a96d3af
|
4
|
+
data.tar.gz: 55fac5447439c53705870a9409268e96aaf633e7a420f9d4678257f9b68f078d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81949b0fb95b4aca53d6fd88f51d8cb4f0c8738bbb3eac83816880ff6b479ac86228847dd6660d8a99a861c5e3aee6e6985a0628764af037b328db55422cc7fb
|
7
|
+
data.tar.gz: 6b40c6be0c5cc6304366fe60c8df54bca9e3ab366338f45308b2267f9a81f6adb123002740feb933af3313a0349a9a5035c39525c0b90d48f875842fefd0c3cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -289,7 +289,7 @@ array = [{name: "a", label: "A"}, {name: "b", label: "B"}, {name: "c", label: "C
|
|
289
289
|
array.pick :name # "a"
|
290
290
|
array.pick :name, :label # ["a", "A"]
|
291
291
|
array.pick # nil
|
292
|
-
[].pick(:
|
292
|
+
[].pick(:other) # nil
|
293
293
|
----
|
294
294
|
|
295
295
|
===== #pluck
|
@@ -303,7 +303,7 @@ array = [{name: "a", label: "A"}, {name: "b", label: "B"}, {name: "c", label: "C
|
|
303
303
|
array.pluck :name # ["a", "b", "c"]
|
304
304
|
array.pluck :name, :label # [["a", "A"], ["b", "B"], ["c", "C"]]
|
305
305
|
array.pluck # []
|
306
|
-
[].pluck :
|
306
|
+
[].pluck :other # []
|
307
307
|
----
|
308
308
|
|
309
309
|
===== #replace_at
|
@@ -365,25 +365,25 @@ Useful when building documentation, answering human readable error messages, etc
|
|
365
365
|
[source,ruby]
|
366
366
|
----
|
367
367
|
[].to_sentence # ""
|
368
|
-
["
|
368
|
+
["demo"].to_sentence # "demo"
|
369
369
|
["a", :b].to_sentence # "a and b"
|
370
|
-
[1, "a", :b, 2.0, /\w+/].
|
370
|
+
[1, "a", :b, 2.0, /\w+/].to_sentence # "1, a, b, 2.0, and (?-mix:\\w+)"
|
371
371
|
%w[one two three].to_sentence # "one, two, and three"
|
372
372
|
%w[eins zwei drei].to_sentence "und", delimiter: " " # "eins zwei und drei"
|
373
373
|
----
|
374
374
|
|
375
375
|
===== #to_usage
|
376
376
|
|
377
|
-
Builds upon and enhances `#to_sentence` further by answering a sentence which all elements are inspected -- where each element of the array is called with `#inspect` -- before turned into a sentence using `"and"` as the default conjunction and `", "` as the default delimiter. This is useful when providing detailed error messages _and_ you need to
|
377
|
+
Builds upon and enhances `#to_sentence` further by answering a sentence which all elements are inspected -- where each element of the array is called with `#inspect` -- before turned into a sentence using `"and"` as the default conjunction and `", "` as the default delimiter. This is useful when providing detailed error messages _and_ you need to detail the types of element used.
|
378
378
|
|
379
379
|
[source,ruby]
|
380
380
|
----
|
381
381
|
[].to_usage # ""
|
382
|
-
["
|
383
|
-
["a", :b].to_usage # "a and b"
|
384
|
-
[1, "a", :b, 2.0, /\w+/].
|
385
|
-
%w[one two three].to_usage # "one, two, and three"
|
386
|
-
%w[eins zwei drei].to_usage "und", delimiter: " " # "eins zwei und drei"
|
382
|
+
["demo"].to_usage # "\"demo\""
|
383
|
+
["a", :b].to_usage # "\"a\" and :b"
|
384
|
+
[1, "a", :b, 2.0, /\w+/].to_usage # "1, \"a\", :b, 2.0, and /\\w+/"
|
385
|
+
%w[one two three].to_usage # "\"one\", \"two\", and \"three\""
|
386
|
+
%w[eins zwei drei].to_usage "und", delimiter: " " # "\"eins\" \"zwei\" und \"drei\""
|
387
387
|
----
|
388
388
|
|
389
389
|
==== Big Decimal
|
@@ -540,12 +540,12 @@ expression `example.fetch(:desired_key) || "default_value"`.
|
|
540
540
|
|
541
541
|
[source,ruby]
|
542
542
|
----
|
543
|
-
{a: "
|
544
|
-
{a: "
|
543
|
+
{a: "demo"}.fetch_value :a, "default" # "demo"
|
544
|
+
{a: "demo"}.fetch_value :a # "demo"
|
545
545
|
{a: nil}.fetch_value :a, "default" # "default"
|
546
546
|
{}.fetch_value(:a) { "default" } # "default"
|
547
547
|
{}.fetch_value :a # KeyError
|
548
|
-
{a: "
|
548
|
+
{a: "demo"}.fetch_value # ArgumentError
|
549
549
|
----
|
550
550
|
|
551
551
|
===== #flatten_keys
|
@@ -555,7 +555,7 @@ though.
|
|
555
555
|
|
556
556
|
[source,ruby]
|
557
557
|
----
|
558
|
-
{a: {b: 1}}.flatten_keys prefix: :
|
558
|
+
{a: {b: 1}}.flatten_keys prefix: :demo # {demo_a_b: 1}
|
559
559
|
{a: {b: 1}}.flatten_keys delimiter: :| # {:"a|b" => 1}
|
560
560
|
|
561
561
|
example = {a: {b: 1}}
|
@@ -570,7 +570,7 @@ though.
|
|
570
570
|
|
571
571
|
[source,ruby]
|
572
572
|
----
|
573
|
-
{a: {b: 1}}.flatten_keys! prefix: :
|
573
|
+
{a: {b: 1}}.flatten_keys! prefix: :demo # {demo_a_b: 1}
|
574
574
|
{a: {b: 1}}.flatten_keys! delimiter: :| # {:"a|b" => 1}
|
575
575
|
|
576
576
|
example = {a: {b: 1}}
|
@@ -735,11 +735,11 @@ answered instead.
|
|
735
735
|
|
736
736
|
[source,ruby]
|
737
737
|
----
|
738
|
-
io = IO.new IO.sysopen(Pathname("
|
738
|
+
io = IO.new IO.sysopen(Pathname("demo.txt").to_s, "w+")
|
739
739
|
other = IO.new IO.sysopen(Pathname("other.txt").to_s, "w+")
|
740
740
|
|
741
741
|
io.redirect other # "#<IO:fd 20>"
|
742
|
-
io.redirect(other) { |stream| stream.write "
|
742
|
+
io.redirect(other) { |stream| stream.write "demo" } # "#<IO:fd 21>"
|
743
743
|
----
|
744
744
|
|
745
745
|
===== #reread
|
@@ -748,15 +748,15 @@ Answers full stream by rewinding to beginning of stream and reading all content.
|
|
748
748
|
|
749
749
|
[source,ruby]
|
750
750
|
----
|
751
|
-
io = IO.new IO.sysopen(Pathname("
|
752
|
-
io.write "This is a
|
751
|
+
io = IO.new IO.sysopen(Pathname("demo.txt").to_s, "w+")
|
752
|
+
io.write "This is a demo."
|
753
753
|
|
754
|
-
io.reread # "This is a
|
754
|
+
io.reread # "This is a demo."
|
755
755
|
io.reread 4 # "This"
|
756
756
|
|
757
757
|
buffer = "".dup
|
758
|
-
io.reread(buffer: buffer) # "This is a
|
759
|
-
buffer # "This is a
|
758
|
+
io.reread(buffer: buffer) # "This is a demo."
|
759
|
+
buffer # "This is a demo."
|
760
760
|
----
|
761
761
|
|
762
762
|
===== #squelch
|
data/refinements.gemspec
CHANGED
data.tar.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
�s�'()���!��q0������z\�.��ئ����I�u#|���~��$ߕ���
|
2
|
+
�=�4���6�$b��r>��*��
|
3
|
+
f���u*��Z��>u7�Ğ�ɍ��+z~x�6 J��-<��1��ƋFԱV�
|
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: 11.0.
|
4
|
+
version: 11.0.1
|
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: 2023-06-
|
38
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email:
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#�],�Gi�ָ7G��ͣDw�>�'���1D4z���+Ph(Y��&i�?���[�N)��3��bGc�a0��OW��g+gV܈9e⍋dD��u�G��y��"ʥ��O�Bkl�a2mz���˗���Qx�
|
2
|
+
�_8�����&�e�������KiEYm�ꏪgH[��?��I�a��üw�h!P��Nx{�bo��q�k]+8��}���֎)4�>���o�̂K�*�"���e�n�T��Q�e�W!2��C�~�z�t+���� o.(o���+�en:����T�
|