refinements 10.0.1 → 10.1.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 +36 -31
- data/lib/refinements/big_decimals.rb +1 -1
- data/lib/refinements/hashes.rb +1 -1
- data/lib/refinements/loggers.rb +2 -0
- data/refinements.gemspec +4 -4
- data.tar.gz.sig +0 -0
- metadata +30 -23
- 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: 82142460f83d84a2b94bf4a1e6c07b4c6839e91f2da64192e0c64a36382fe3e5
         | 
| 4 | 
            +
              data.tar.gz: d657c64e946049d4c946513329446b781880c34c76301408318a8487e0728f17
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 81df10e22a7fb65d5737e7a8c23114fdecd47bcdecf532bc231612d29cd9036a90444fd8d59b5d140ab7c72347a1bbbbc9dee9b1e8c3464962b146ad5dc82085
         | 
| 7 | 
            +
              data.tar.gz: 4446cffdb57fe7383f891193a95edc8c0a023da2f6670fb13a00730be21113123a55f8f13ad9cf9fad39954af418142e5e17e8b6b00cac0fb815b5ed6592252d
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/README.adoc
    CHANGED
    
    | @@ -4,11 +4,7 @@ | |
| 4 4 |  | 
| 5 5 | 
             
            = Refinements
         | 
| 6 6 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
            to debug link:https://www.alchemists.io/articles/ruby_antipatterns/#_monkey_patches[monkey patches].
         | 
| 9 | 
            -
            These refinements give you additional syntactic sugar to develop clean and concise implementations
         | 
| 10 | 
            -
            while using less code. By refining our code we can acquire the functionality we wish the core
         | 
| 11 | 
            -
            primitives had!
         | 
| 7 | 
            +
            These refinements augment and enhance Ruby primitives so you can avoid link:https://alchemists.io/articles/ruby_antipatterns/#_monkey_patches[monkey patches]. They also allow you to develop clean and concise implementations while using less code. By refining your code, you can acquire the functionality you wish the core primitives had!
         | 
| 12 8 |  | 
| 13 9 | 
             
            toc::[]
         | 
| 14 10 |  | 
| @@ -31,8 +27,7 @@ Enhances the following objects: | |
| 31 27 | 
             
            == Requirements
         | 
| 32 28 |  | 
| 33 29 | 
             
            . https://www.ruby-lang.org[Ruby].
         | 
| 34 | 
            -
            . A solid understanding of link:https:// | 
| 35 | 
            -
              and lexical scope].
         | 
| 30 | 
            +
            . A solid understanding of link:https://alchemists.io/articles/ruby_refinements[refinements].
         | 
| 36 31 |  | 
| 37 32 | 
             
            == Setup
         | 
| 38 33 |  | 
| @@ -54,7 +49,7 @@ gem "refinements" | |
| 54 49 |  | 
| 55 50 | 
             
            === Requires
         | 
| 56 51 |  | 
| 57 | 
            -
            If  | 
| 52 | 
            +
            If no refinements are desired, then add the following to your `Gemfile` instead:
         | 
| 58 53 |  | 
| 59 54 | 
             
            [source,ruby]
         | 
| 60 55 | 
             
            ----
         | 
| @@ -195,7 +190,7 @@ Adds given array or elements without mutating itself. | |
| 195 190 |  | 
| 196 191 | 
             
            ===== #intersperse
         | 
| 197 192 |  | 
| 198 | 
            -
            Inserts additional elements or array between all members of given array.
         | 
| 193 | 
            +
            Inserts additional elements or an array between all members of given array.
         | 
| 199 194 |  | 
| 200 195 | 
             
            [source,ruby]
         | 
| 201 196 | 
             
            ----
         | 
| @@ -371,7 +366,7 @@ example[:b]  # [] | |
| 371 366 |  | 
| 372 367 | 
             
            ===== #compress
         | 
| 373 368 |  | 
| 374 | 
            -
            Removes `nil` and empty objects without mutating itself. Answers itself if  | 
| 369 | 
            +
            Removes `nil` and empty objects without mutating itself. Answers itself if nothing to remove.
         | 
| 375 370 |  | 
| 376 371 | 
             
            [source,ruby]
         | 
| 377 372 | 
             
            ----
         | 
| @@ -386,7 +381,7 @@ example                # {a: 1, b: "blueberry", c: nil, d: "", e: [], f: {}, g: | |
| 386 381 |  | 
| 387 382 | 
             
            ===== #compress!
         | 
| 388 383 |  | 
| 389 | 
            -
            Removes `nil` and empty objects while mutating itself. Answers `nil` if  | 
| 384 | 
            +
            Removes `nil` and empty objects while mutating itself. Answers `nil` if nothing to remove.
         | 
| 390 385 |  | 
| 391 386 | 
             
            [source,ruby]
         | 
| 392 387 | 
             
            ----
         | 
| @@ -584,9 +579,7 @@ example                  # {a: 1, b: 2} | |
| 584 579 |  | 
| 585 580 | 
             
            ===== #transform_with
         | 
| 586 581 |  | 
| 587 | 
            -
            Transforms  | 
| 588 | 
            -
             | 
| 589 | 
            -
            You can transform multiple values at once:
         | 
| 582 | 
            +
            Transforms values of keys using specific operations (i.e. any object that responds to `#call`). Does not mutate itself and you can transform multiple values at once:
         | 
| 590 583 |  | 
| 591 584 | 
             
            [source,ruby]
         | 
| 592 585 | 
             
            ----
         | 
| @@ -605,7 +598,7 @@ example.transform_with bogus: -> value { value.tr "<>", "" } | |
| 605 598 | 
             
            # {email: "<jd@example.com>"}
         | 
| 606 599 | 
             
            ----
         | 
| 607 600 |  | 
| 608 | 
            -
            The original object  | 
| 601 | 
            +
            The original object _will not_ be mutated:
         | 
| 609 602 |  | 
| 610 603 | 
             
            [source,ruby]
         | 
| 611 604 | 
             
            ----
         | 
| @@ -614,9 +607,7 @@ example  # {name: "Jayne Doe", email: "<jd@example.com>"} | |
| 614 607 |  | 
| 615 608 | 
             
            ===== #transform_with!
         | 
| 616 609 |  | 
| 617 | 
            -
            Transforms  | 
| 618 | 
            -
             | 
| 619 | 
            -
            You can transform multiple values at once:
         | 
| 610 | 
            +
            Transforms values of keys using specific operations (i.e. any object that responds to `#call`). Mutates itself and you can transform multiple values at once:
         | 
| 620 611 |  | 
| 621 612 | 
             
            [source,ruby]
         | 
| 622 613 | 
             
            ----
         | 
| @@ -635,7 +626,7 @@ example.transform_with! bogus: -> value { value.tr "<>", "" } | |
| 635 626 | 
             
            # {email: "<jd@example.com>"}
         | 
| 636 627 | 
             
            ----
         | 
| 637 628 |  | 
| 638 | 
            -
            The original object  | 
| 629 | 
            +
            The original object _will be_ mutated:
         | 
| 639 630 |  | 
| 640 631 | 
             
            [source,ruby]
         | 
| 641 632 | 
             
            ----
         | 
| @@ -644,7 +635,7 @@ example  # {name: "Jayne", email: "jd@example.com"} | |
| 644 635 |  | 
| 645 636 | 
             
            ===== #use
         | 
| 646 637 |  | 
| 647 | 
            -
             | 
| 638 | 
            +
            Uses the hash's keys as block arguments where the value of the block argument is equal to the value of the key found within the hash. Works best with hashes that use symbols for keys but falls back to string keys when symbol keys can't be found.
         | 
| 648 639 |  | 
| 649 640 | 
             
            [source,ruby]
         | 
| 650 641 | 
             
            ----
         | 
| @@ -760,6 +751,20 @@ logger.write "Test." | |
| 760 751 | 
             
            logger.reread                     # ""
         | 
| 761 752 | 
             
            ----
         | 
| 762 753 |  | 
| 754 | 
            +
            ===== #any
         | 
| 755 | 
            +
             | 
| 756 | 
            +
            Allows you to log _any_ message which is identical in behavior and functionality to the `Logger#unknown` method only this requires less typing and better matches the terminology used by the `#unknown` method.
         | 
| 757 | 
            +
             | 
| 758 | 
            +
            ``` ruby
         | 
| 759 | 
            +
            logger = Logger.new STDOUT
         | 
| 760 | 
            +
             | 
| 761 | 
            +
            logger.any "Test."
         | 
| 762 | 
            +
            # A, [2000-01-10T09:00:00.847428 #44925]   ANY -- : Test.
         | 
| 763 | 
            +
             | 
| 764 | 
            +
            logger.any { "Test." }
         | 
| 765 | 
            +
            A, [2000-01-10T09:00:00.330719 #44925]   ANY -- : Test.
         | 
| 766 | 
            +
            ```
         | 
| 767 | 
            +
             | 
| 763 768 | 
             
            ==== Pathname
         | 
| 764 769 |  | 
| 765 770 | 
             
            ===== Pathname
         | 
| @@ -817,7 +822,7 @@ before being required to ensure consistent behavior. Example: | |
| 817 822 | 
             
            Dir[File.join(__dir__, "support/shared_contexts/**/*.rb")].sort.each { |path| require path }
         | 
| 818 823 |  | 
| 819 824 | 
             
            # After
         | 
| 820 | 
            -
            Pathname.require_tree __dir__ | 
| 825 | 
            +
            Pathname.require_tree "#{__dir__}/support/shared_contexts"
         | 
| 821 826 | 
             
            ----
         | 
| 822 827 |  | 
| 823 828 | 
             
            The following are further examples of potential usage:
         | 
| @@ -831,7 +836,7 @@ Pathname.require_tree __dir__ | |
| 831 836 | 
             
            Pathname.require_tree "/test"
         | 
| 832 837 |  | 
| 833 838 | 
             
            # Requires all files in RSpec shared examples directory structure.
         | 
| 834 | 
            -
            Pathname.require_tree SPEC_ROOT | 
| 839 | 
            +
            Pathname.require_tree SPEC_ROOT.join("support/shared_examples")
         | 
| 835 840 | 
             
            ----
         | 
| 836 841 |  | 
| 837 842 | 
             
            ===== .root
         | 
| @@ -1133,7 +1138,7 @@ Answers first character of a string or first set of characters if given a number | |
| 1133 1138 |  | 
| 1134 1139 | 
             
            ===== #indent
         | 
| 1135 1140 |  | 
| 1136 | 
            -
            Answers string  | 
| 1141 | 
            +
            Answers indentation (string) which is the result of the multiplier times padding. By default, the multiplier is `1` and the padding is `"  "` which equates to two spaces.
         | 
| 1137 1142 |  | 
| 1138 1143 | 
             
            [source,ruby]
         | 
| 1139 1144 | 
             
            ----
         | 
| @@ -1439,19 +1444,19 @@ To test, run: | |
| 1439 1444 | 
             
            bin/rake
         | 
| 1440 1445 | 
             
            ----
         | 
| 1441 1446 |  | 
| 1442 | 
            -
            == link:https:// | 
| 1447 | 
            +
            == link:https://alchemists.io/policies/license[License]
         | 
| 1443 1448 |  | 
| 1444 | 
            -
            == link:https:// | 
| 1449 | 
            +
            == link:https://alchemists.io/policies/security[Security]
         | 
| 1445 1450 |  | 
| 1446 | 
            -
            == link:https:// | 
| 1451 | 
            +
            == link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]
         | 
| 1447 1452 |  | 
| 1448 | 
            -
            == link:https:// | 
| 1453 | 
            +
            == link:https://alchemists.io/policies/contributions[Contributions]
         | 
| 1449 1454 |  | 
| 1450 | 
            -
            == link:https:// | 
| 1455 | 
            +
            == link:https://alchemists.io/projects/refinements/versions[Versions]
         | 
| 1451 1456 |  | 
| 1452 | 
            -
            == link:https:// | 
| 1457 | 
            +
            == link:https://alchemists.io/community[Community]
         | 
| 1453 1458 |  | 
| 1454 1459 | 
             
            == Credits
         | 
| 1455 1460 |  | 
| 1456 | 
            -
            * Built with link:https:// | 
| 1457 | 
            -
            * Engineered by link:https:// | 
| 1461 | 
            +
            * Built with link:https://alchemists.io/projects/gemsmith[Gemsmith].
         | 
| 1462 | 
            +
            * Engineered by link:https://alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
         | 
| @@ -6,7 +6,7 @@ module Refinements | |
| 6 6 | 
             
              # Provides additional enhancements to the BigDecimal primitive.
         | 
| 7 7 | 
             
              module BigDecimals
         | 
| 8 8 | 
             
                refine BigDecimal do
         | 
| 9 | 
            -
                  def inspect = format("#<BigDecimal | 
| 9 | 
            +
                  def inspect = format("#<BigDecimal:%<id>s %<string>s>", id: object_id, string: to_s("F"))
         | 
| 10 10 | 
             
                end
         | 
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
            end
         | 
    
        data/lib/refinements/hashes.rb
    CHANGED
    
    
    
        data/lib/refinements/loggers.rb
    CHANGED
    
    
    
        data/refinements.gemspec
    CHANGED
    
    | @@ -2,17 +2,17 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |spec|
         | 
| 4 4 | 
             
              spec.name = "refinements"
         | 
| 5 | 
            -
              spec.version = "10. | 
| 5 | 
            +
              spec.version = "10.1.1"
         | 
| 6 6 | 
             
              spec.authors = ["Brooke Kuhlmann"]
         | 
| 7 7 | 
             
              spec.email = ["brooke@alchemists.io"]
         | 
| 8 | 
            -
              spec.homepage = "https:// | 
| 8 | 
            +
              spec.homepage = "https://alchemists.io/projects/refinements"
         | 
| 9 9 | 
             
              spec.summary = "A collection of refinements to core Ruby objects."
         | 
| 10 10 | 
             
              spec.license = "Hippocratic-2.1"
         | 
| 11 11 |  | 
| 12 12 | 
             
              spec.metadata = {
         | 
| 13 13 | 
             
                "bug_tracker_uri" => "https://github.com/bkuhlmann/refinements/issues",
         | 
| 14 | 
            -
                "changelog_uri" => "https:// | 
| 15 | 
            -
                "documentation_uri" => "https:// | 
| 14 | 
            +
                "changelog_uri" => "https://alchemists.io/projects/refinements/versions",
         | 
| 15 | 
            +
                "documentation_uri" => "https://alchemists.io/projects/refinements",
         | 
| 16 16 | 
             
                "funding_uri" => "https://github.com/sponsors/bkuhlmann",
         | 
| 17 17 | 
             
                "label" => "Refinements",
         | 
| 18 18 | 
             
                "rubygems_mfa_required" => "true",
         | 
    
        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: 10. | 
| 4 | 
            +
              version: 10.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Brooke Kuhlmann
         | 
| @@ -10,25 +10,32 @@ bindir: bin | |
| 10 10 | 
             
            cert_chain:
         | 
| 11 11 | 
             
            - |
         | 
| 12 12 | 
             
              -----BEGIN CERTIFICATE-----
         | 
| 13 | 
            -
               | 
| 14 | 
            -
               | 
| 15 | 
            -
               | 
| 16 | 
            -
               | 
| 17 | 
            -
               | 
| 18 | 
            -
               | 
| 19 | 
            -
               | 
| 20 | 
            -
               | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
               | 
| 24 | 
            -
               | 
| 25 | 
            -
               | 
| 26 | 
            -
               | 
| 27 | 
            -
               | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 13 | 
            +
              MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZicm9v
         | 
| 14 | 
            +
              a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
         | 
| 15 | 
            +
              aW8wHhcNMjMwMzIyMTYxNDQxWhcNMjUwMzIxMTYxNDQxWjBBMQ8wDQYDVQQDDAZi
         | 
| 16 | 
            +
              cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
         | 
| 17 | 
            +
              GRYCaW8wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCro8tj5/E1Hg88
         | 
| 18 | 
            +
              f4qfiwPVd2zJQHvdYt4GHVvuHRRgx4HGhJuNp+4BId08RBn7V6V1MW6MY3kezRBs
         | 
| 19 | 
            +
              M+7QOQ4b1xNLTvY7FYQB1wGK5a4x7TTokDrPYQxDB2jmsdDYCzVbIMrAvUfcecRi
         | 
| 20 | 
            +
              khyGZCdByiiCl4fKv77P12tTT+NfsvXkLt/AYCGwjOUyGKTQ01Z6eC09T27GayPH
         | 
| 21 | 
            +
              QQvIkakyFgcJtzSyGzs8bzK5q9u7wQ12MNTjJoXzW69lqp0oNvDylu81EiSUb5S6
         | 
| 22 | 
            +
              QzzPxZBiRB1sgtbt1gUbVI262ZDq1gR+HxPFmp+Cgt7ZLIJZAtesQvtcMzseXpfn
         | 
| 23 | 
            +
              hpmm0Sw22KGhRAy/mqHBRhDl5HqS1SJp2Ko3lcnpXeFResp0HNlt8NSu13vhC08j
         | 
| 24 | 
            +
              GUHU9MyIXbFOsnp3K3ADrAVjPWop8EZkmUR3MV/CUm00w2cZHCSGiXl1KMpiVKvk
         | 
| 25 | 
            +
              Ywr1gd2ZME4QLSo+EXUtLxDUa/W3xnBS8dBOuMMz02FPWYr3PN8CAwEAAaN7MHkw
         | 
| 26 | 
            +
              CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAFgmv0tYMZnItuPycSM
         | 
| 27 | 
            +
              F5wykJEVMB8GA1UdEQQYMBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMB8GA1UdEgQY
         | 
| 28 | 
            +
              MBaBFGJyb29rZUBhbGNoZW1pc3RzLmlvMA0GCSqGSIb3DQEBCwUAA4IBgQAX+EGY
         | 
| 29 | 
            +
              9RLYGxF1VLZz+G1ACQc4uyrCB6kXwI06kzUa5dF9tPXqTX9ffnz3/W8ck2IQhKzu
         | 
| 30 | 
            +
              MKO2FVijzbDWTsZeZGglS4E+4Jxpau1lU9HhOIcKolv6LeC6UdALTFudY+GLb8Xw
         | 
| 31 | 
            +
              REXgaJkjzzhkUSILmEnRwEbY08dVSl7ZAaxVI679vfI2yapLlIwpbBgmQTiTvPr3
         | 
| 32 | 
            +
              qyyLUno9flYEOv9fmGHunSrM+gE0/0niGTXa5GgXBXYGS2he4LQGgSBfGp/cTwMU
         | 
| 33 | 
            +
              rDKJRcusZ12lNBeDfgqACz/BBJF8FLodgk6rGMRZz7+ZmjjHEmpG5bQpR6Q2BuWL
         | 
| 34 | 
            +
              XMtYk/QzaWuhiR7pWjiF8jbdd7RO6or0ohq7iFkokz/5xrtQ/vPzU2RQ3Qc6YaKw
         | 
| 35 | 
            +
              3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
         | 
| 36 | 
            +
              gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
         | 
| 30 37 | 
             
              -----END CERTIFICATE-----
         | 
| 31 | 
            -
            date: 2023- | 
| 38 | 
            +
            date: 2023-04-08 00:00:00.000000000 Z
         | 
| 32 39 | 
             
            dependencies: []
         | 
| 33 40 | 
             
            description:
         | 
| 34 41 | 
             
            email:
         | 
| @@ -57,13 +64,13 @@ files: | |
| 57 64 | 
             
            - lib/refinements/structs.rb
         | 
| 58 65 | 
             
            - lib/refinements/symbols.rb
         | 
| 59 66 | 
             
            - refinements.gemspec
         | 
| 60 | 
            -
            homepage: https:// | 
| 67 | 
            +
            homepage: https://alchemists.io/projects/refinements
         | 
| 61 68 | 
             
            licenses:
         | 
| 62 69 | 
             
            - Hippocratic-2.1
         | 
| 63 70 | 
             
            metadata:
         | 
| 64 71 | 
             
              bug_tracker_uri: https://github.com/bkuhlmann/refinements/issues
         | 
| 65 | 
            -
              changelog_uri: https:// | 
| 66 | 
            -
              documentation_uri: https:// | 
| 72 | 
            +
              changelog_uri: https://alchemists.io/projects/refinements/versions
         | 
| 73 | 
            +
              documentation_uri: https://alchemists.io/projects/refinements
         | 
| 67 74 | 
             
              funding_uri: https://github.com/sponsors/bkuhlmann
         | 
| 68 75 | 
             
              label: Refinements
         | 
| 69 76 | 
             
              rubygems_mfa_required: 'true'
         | 
| @@ -83,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 83 90 | 
             
                - !ruby/object:Gem::Version
         | 
| 84 91 | 
             
                  version: '0'
         | 
| 85 92 | 
             
            requirements: []
         | 
| 86 | 
            -
            rubygems_version: 3.4. | 
| 93 | 
            +
            rubygems_version: 3.4.10
         | 
| 87 94 | 
             
            signing_key:
         | 
| 88 95 | 
             
            specification_version: 4
         | 
| 89 96 | 
             
            summary: A collection of refinements to core Ruby objects.
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |