refinements 12.0.0 → 12.1.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 +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data/README.adoc +12 -7
 - data/lib/refinements/hash.rb +3 -1
 - data/lib/refinements/io.rb +0 -2
 - data/lib/refinements/symbol.rb +0 -2
 - data/refinements.gemspec +1 -1
 - data.tar.gz.sig +0 -0
 - metadata +3 -3
 - 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: 2067ee329cd6e63e9e6a2045815951df747abe35b5e8e6c456f60ab7242b4d59
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4e41441c9b45b303a3b179a620c35ffe7605eb8b53992ea654812ae6ba302b3a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 248aa4f7d8f182f2b6f268c135f773ea0076d89cf3a6cc671433f8383efee30fc056d0fdf660af21b1bd97e4ed10bfc1b2579298acdfa81309b6e9305ca70da5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fb0ba5bf68bfd7fc06477cb5b049c79a16f5e69a27dc7203088db835df3ed2f028796e637fdacb87c1b49145601c0986048272c1580f58e1a2c52c6e36e2c8ff
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/README.adoc
    CHANGED
    
    | 
         @@ -376,9 +376,11 @@ Useful when building documentation, answering human readable error messages, etc 
     | 
|
| 
       376 
376 
     | 
    
         
             
            %w[eins zwei drei].to_sentence "und", delimiter: " "  # "eins zwei und drei"
         
     | 
| 
       377 
377 
     | 
    
         
             
            ----
         
     | 
| 
       378 
378 
     | 
    
         | 
| 
      
 379 
     | 
    
         
            +
            💡 You can use a string or a symbol for the conjunction (i.e. `"and"` or `:and`).
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
       379 
381 
     | 
    
         
             
            ===== #to_usage
         
     | 
| 
       380 
382 
     | 
    
         | 
| 
       381 
     | 
    
         
            -
             
     | 
| 
      
 383 
     | 
    
         
            +
            Further enhances `#to_sentence` by answering a sentence where all elements are inspected (i.e. `#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 the _types_ of all elements preserved.
         
     | 
| 
       382 
384 
     | 
    
         | 
| 
       383 
385 
     | 
    
         
             
            [source,ruby]
         
     | 
| 
       384 
386 
     | 
    
         
             
            ----
         
     | 
| 
         @@ -390,6 +392,8 @@ Builds upon and enhances `#to_sentence` further by answering a sentence which al 
     | 
|
| 
       390 
392 
     | 
    
         
             
            %w[eins zwei drei].to_usage "und", delimiter: " "  # "\"eins\" \"zwei\" und \"drei\""
         
     | 
| 
       391 
393 
     | 
    
         
             
            ----
         
     | 
| 
       392 
394 
     | 
    
         | 
| 
      
 395 
     | 
    
         
            +
            💡 You can use a string or a symbol for the conjunction (i.e. `"and"` or `:and`).
         
     | 
| 
      
 396 
     | 
    
         
            +
             
     | 
| 
       393 
397 
     | 
    
         
             
            ==== Data
         
     | 
| 
       394 
398 
     | 
    
         | 
| 
       395 
399 
     | 
    
         
             
            ===== #diff
         
     | 
| 
         @@ -575,12 +579,13 @@ expression `example.fetch(:desired_key) || "default_value"`. 
     | 
|
| 
       575 
579 
     | 
    
         | 
| 
       576 
580 
     | 
    
         
             
            [source,ruby]
         
     | 
| 
       577 
581 
     | 
    
         
             
            ----
         
     | 
| 
       578 
     | 
    
         
            -
            {a: "demo"}.fetch_value :a, "default" 
     | 
| 
       579 
     | 
    
         
            -
            {a: "demo"}.fetch_value :a 
     | 
| 
       580 
     | 
    
         
            -
            {a: nil}.fetch_value :a, "default" 
     | 
| 
       581 
     | 
    
         
            -
            {}.fetch_value(:a) { "default" } 
     | 
| 
       582 
     | 
    
         
            -
            {}.fetch_value :a 
     | 
| 
       583 
     | 
    
         
            -
            {a 
     | 
| 
      
 582 
     | 
    
         
            +
            {a: "demo"}.fetch_value :a, "default"   # "demo"
         
     | 
| 
      
 583 
     | 
    
         
            +
            {a: "demo"}.fetch_value :a              # "demo"
         
     | 
| 
      
 584 
     | 
    
         
            +
            {a: nil}.fetch_value :a, "default"      # "default"
         
     | 
| 
      
 585 
     | 
    
         
            +
            {a: nil}.fetch_value(:a) { "default" }  # "default"
         
     | 
| 
      
 586 
     | 
    
         
            +
            {}.fetch_value :a                       # KeyError
         
     | 
| 
      
 587 
     | 
    
         
            +
            {}.fetch_value(:a) { "default" }        # "default"
         
     | 
| 
      
 588 
     | 
    
         
            +
            {a: "demo"}.fetch_value                 # ArgumentError
         
     | 
| 
       584 
589 
     | 
    
         
             
            ----
         
     | 
| 
       585 
590 
     | 
    
         | 
| 
       586 
591 
     | 
    
         
             
            ===== #flatten_keys
         
     | 
    
        data/lib/refinements/hash.rb
    CHANGED
    
    | 
         @@ -51,7 +51,9 @@ module Refinements 
     | 
|
| 
       51 
51 
     | 
    
         
             
                    each.with_object({}) { |(key, value), diff| diff[key] = [value, nil] }
         
     | 
| 
       52 
52 
     | 
    
         
             
                  end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                  def fetch_value(key, *default, &) 
     | 
| 
      
 54 
     | 
    
         
            +
                  def fetch_value(key, *default, &)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    fetch(key, *default, &) || (yield if block_given?) || default.first
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
       55 
57 
     | 
    
         | 
| 
       56 
58 
     | 
    
         
             
                  def flatten_keys prefix: nil, delimiter: "_"
         
     | 
| 
       57 
59 
     | 
    
         
             
                    reduce({}) do |accumulator, (key, value)|
         
     | 
    
        data/lib/refinements/io.rb
    CHANGED
    
    
    
        data/lib/refinements/symbol.rb
    CHANGED
    
    | 
         @@ -4,11 +4,9 @@ module Refinements 
     | 
|
| 
       4 
4 
     | 
    
         
             
              # Provides additional enhancements to the Symbol primitive.
         
     | 
| 
       5 
5 
     | 
    
         
             
              module Symbol
         
     | 
| 
       6 
6 
     | 
    
         
             
                refine ::Symbol do
         
     | 
| 
       7 
     | 
    
         
            -
                  # rubocop:todo Naming/BlockForwarding
         
     | 
| 
       8 
7 
     | 
    
         
             
                  def call(*arguments, &block)
         
     | 
| 
       9 
8 
     | 
    
         
             
                    proc { |receiver| receiver.public_send self, *arguments, &block }
         
     | 
| 
       10 
9 
     | 
    
         
             
                  end
         
     | 
| 
       11 
     | 
    
         
            -
                  # rubocop:enable Naming/BlockForwarding
         
     | 
| 
       12 
10 
     | 
    
         
             
                end
         
     | 
| 
       13 
11 
     | 
    
         
             
              end
         
     | 
| 
       14 
12 
     | 
    
         
             
            end
         
     | 
    
        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: 12. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 12.1.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-01- 
     | 
| 
      
 38 
     | 
    
         
            +
            date: 2024-01-28 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. 
     | 
| 
      
 94 
     | 
    
         
            +
            rubygems_version: 3.5.5
         
     | 
| 
       95 
95 
     | 
    
         
             
            signing_key:
         
     | 
| 
       96 
96 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       97 
97 
     | 
    
         
             
            summary: A collection of core Ruby object refinements.
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |