govuk_design_system_formbuilder 2.5.1b1 → 2.5.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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 98eb37a7c0dc6926abc94003671567e1d6d9ff64026d92dbd2bbeb62e132b5ac
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3bdd6d81f7c94f28e39841088d056c8eb7615dab89cd750e589d516f71faae0a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eae5b13528432a2c01a85aba212b74ecfcdb5740ecbe43bf6548749ebc1ab98b7a37281f7bea6b4e85964d73076e19a1a05326011d2edd71f1599075e6545e2b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c24c784e74e4ae48fdafcca7bf3ba3b5e5f3e22a371f0b5e16bd6fc364f1cb3d386be4bff9ea03de0ce3d5857676eca58001b09284a625d9fcd2dc6ef728a9e5
         
     | 
| 
         @@ -72,8 +72,7 @@ module GOVUKDesignSystemFormBuilder 
     | 
|
| 
       72 
72 
     | 
    
         
             
                localisation_schema_legend: nil,
         
     | 
| 
       73 
73 
     | 
    
         
             
                localisation_schema_caption: nil,
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                enable_logger: true 
     | 
| 
       76 
     | 
    
         
            -
                enable_log_on_invalid_date: false
         
     | 
| 
      
 75 
     | 
    
         
            +
                enable_logger: true
         
     | 
| 
       77 
76 
     | 
    
         
             
              }.freeze
         
     | 
| 
       78 
77 
     | 
    
         | 
| 
       79 
78 
     | 
    
         
             
              DEFAULTS.each_key { |k| config_accessor(k) { DEFAULTS[k] } }
         
     | 
| 
         @@ -82,10 +82,6 @@ module GOVUKDesignSystemFormBuilder 
     | 
|
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                        nil
         
     | 
| 
       84 
84 
     | 
    
         
             
                      end
         
     | 
| 
       85 
     | 
    
         
            -
                    elsif config.enable_log_on_invalid_date
         
     | 
| 
       86 
     | 
    
         
            -
                      warn("invalid Date-like object: should be a Date, Time, DateTime or Hash in MULTIPARAMETER_KEY format")
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                      nil
         
     | 
| 
       89 
85 
     | 
    
         
             
                    else
         
     | 
| 
       90 
86 
     | 
    
         
             
                      fail(ArgumentError, "invalid Date-like object: must be a Date, Time, DateTime or Hash in MULTIPARAMETER_KEY format")
         
     | 
| 
       91 
87 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -1,11 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module GOVUKDesignSystemFormBuilder
         
     | 
| 
       2 
2 
     | 
    
         
             
              module Traits
         
     | 
| 
       3 
3 
     | 
    
         
             
                module HTMLAttributes
         
     | 
| 
       4 
     | 
    
         
            -
                  # Attributes eases working with default and custom attributes by
         
     | 
| 
      
 4 
     | 
    
         
            +
                  # Attributes eases working with default and custom attributes by:
         
     | 
| 
       5 
5 
     | 
    
         
             
                  # * deeply merging them so both the default (required) attributes are
         
     | 
| 
       6 
6 
     | 
    
         
             
                  #   present
         
     | 
| 
       7 
7 
     | 
    
         
             
                  # * joins the arrays into strings to maintain Rails 6.0.3 compatibility
         
     | 
| 
       8 
8 
     | 
    
         
             
                  class Attributes
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Don't try to deep merge these fields, when we remove duplicates
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # whilst merging the resulting values later, repeating words are lost
         
     | 
| 
      
 11 
     | 
    
         
            +
                    SKIP = [
         
     | 
| 
      
 12 
     | 
    
         
            +
                      %i(id),
         
     | 
| 
      
 13 
     | 
    
         
            +
                      %i(value),
         
     | 
| 
      
 14 
     | 
    
         
            +
                      %i(title),
         
     | 
| 
      
 15 
     | 
    
         
            +
                      %i(alt),
         
     | 
| 
      
 16 
     | 
    
         
            +
                      %i(href),
         
     | 
| 
      
 17 
     | 
    
         
            +
                      %i(aria label)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    ].freeze
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       9 
20 
     | 
    
         
             
                    def initialize(defaults, custom)
         
     | 
| 
       10 
21 
     | 
    
         
             
                      @merged = defaults.deeper_merge(deep_split_values(custom))
         
     | 
| 
       11 
22 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -16,19 +27,27 @@ module GOVUKDesignSystemFormBuilder 
     | 
|
| 
       16 
27 
     | 
    
         | 
| 
       17 
28 
     | 
    
         
             
                  private
         
     | 
| 
       18 
29 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                    def deep_split_values(hash)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    def deep_split_values(hash, parent = nil)
         
     | 
| 
       20 
31 
     | 
    
         
             
                      hash.each.with_object({}) do |(key, value), result|
         
     | 
| 
       21 
32 
     | 
    
         
             
                        result[key] = case value
         
     | 
| 
       22 
33 
     | 
    
         
             
                                      when Hash
         
     | 
| 
       23 
     | 
    
         
            -
                                        deep_split_values(value)
         
     | 
| 
      
 34 
     | 
    
         
            +
                                        deep_split_values(value, key)
         
     | 
| 
       24 
35 
     | 
    
         
             
                                      when String
         
     | 
| 
       25 
     | 
    
         
            -
                                        value 
     | 
| 
      
 36 
     | 
    
         
            +
                                        split_list_values(key, value, parent)
         
     | 
| 
       26 
37 
     | 
    
         
             
                                      else
         
     | 
| 
       27 
38 
     | 
    
         
             
                                        value
         
     | 
| 
       28 
39 
     | 
    
         
             
                                      end
         
     | 
| 
       29 
40 
     | 
    
         
             
                      end
         
     | 
| 
       30 
41 
     | 
    
         
             
                    end
         
     | 
| 
       31 
42 
     | 
    
         | 
| 
      
 43 
     | 
    
         
            +
                    def split_list_values(key, value, parent = nil)
         
     | 
| 
      
 44 
     | 
    
         
            +
                      if [parent, key].compact.in?(SKIP)
         
     | 
| 
      
 45 
     | 
    
         
            +
                        value
         
     | 
| 
      
 46 
     | 
    
         
            +
                      else
         
     | 
| 
      
 47 
     | 
    
         
            +
                        value.split
         
     | 
| 
      
 48 
     | 
    
         
            +
                      end
         
     | 
| 
      
 49 
     | 
    
         
            +
                    end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       32 
51 
     | 
    
         
             
                    def deep_join_values(hash)
         
     | 
| 
       33 
52 
     | 
    
         
             
                      hash.each.with_object({}) do |(key, value), result|
         
     | 
| 
       34 
53 
     | 
    
         
             
                        result[key] = case value
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: govuk_design_system_formbuilder
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.5.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Peter Yates
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-05-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: deep_merge
         
     | 
| 
         @@ -363,9 +363,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       363 
363 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       364 
364 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       365 
365 
     | 
    
         
             
              requirements:
         
     | 
| 
       366 
     | 
    
         
            -
              - - " 
     | 
| 
      
 366 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       367 
367 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       368 
     | 
    
         
            -
                  version:  
     | 
| 
      
 368 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       369 
369 
     | 
    
         
             
            requirements: []
         
     | 
| 
       370 
370 
     | 
    
         
             
            rubygems_version: 3.1.6
         
     | 
| 
       371 
371 
     | 
    
         
             
            signing_key: 
         
     |