formula 2.0.0 → 2.0.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
 - data/lib/formula/form_builder.rb +16 -16
 - data/lib/formula/version.rb +1 -1
 - metadata +5 -7
 - data/bin/rubocop +0 -8
 - data/bin/test +0 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c35ca75ec6839e2a9b31e2b19297a9dd158cf1fdc4cbf7338c14ee5f68053527
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 57d815849f7a9b882d4fb9d067dac78b75ca8650ff69aa22c162124868b6f092
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 74f973a9692a9208b59dd70fbf26eb263e7d1757626200282f265acf0e90899f9067979841983e4f63b720c78ae112beb76091439448af75b5374eaf3629f25b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a4d6f9914b5e5f08d1dbe182604c47a1799fb6e9489c4263c6309c8085aa8464e2af92c1dccd1a2cb764aa75ca8bedf95fb895b77c5f94e7a7808ca573d3c4ac
         
     | 
    
        data/lib/formula/form_builder.rb
    CHANGED
    
    | 
         @@ -39,7 +39,7 @@ module Formula 
     | 
|
| 
       39 
39 
     | 
    
         
             
                #
         
     | 
| 
       40 
40 
     | 
    
         
             
                # Usage:
         
     | 
| 
       41 
41 
     | 
    
         
             
                #
         
     | 
| 
       42 
     | 
    
         
            -
                #   f.block(:name, : 
     | 
| 
      
 42 
     | 
    
         
            +
                #   f.block(:name, label: "Name:", hint: "Please use your full name.", container: { class: 'fill' }) do
         
     | 
| 
       43 
43 
     | 
    
         
             
                #     ...
         
     | 
| 
       44 
44 
     | 
    
         
             
                #   end
         
     | 
| 
       45 
45 
     | 
    
         
             
                #
         
     | 
| 
         @@ -51,14 +51,14 @@ module Formula 
     | 
|
| 
       51 
51 
     | 
    
         
             
                #     <div class="hint">Please use your full name.</div>
         
     | 
| 
       52 
52 
     | 
    
         
             
                #     <div class="error">...</div>
         
     | 
| 
       53 
53 
     | 
    
         
             
                #   </div>
         
     | 
| 
       54 
     | 
    
         
            -
                def block(method = nil, options = {}, & 
     | 
| 
      
 54 
     | 
    
         
            +
                def block(method = nil, options = {}, &)
         
     | 
| 
       55 
55 
     | 
    
         
             
                  options[:error] ||= error(method) if method
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                  components = ''.html_safe
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                  components << label(method, options[:label], config.label_options) if method
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                  components << @template.capture(& 
     | 
| 
      
 61 
     | 
    
         
            +
                  components << @template.capture(&)
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
                  options[:container] ||= {}
         
     | 
| 
       64 
64 
     | 
    
         
             
                  options[:container][:class] = arrayorize(options[:container][:class]) << config.block_class << method
         
     | 
| 
         @@ -85,15 +85,15 @@ module Formula 
     | 
|
| 
       85 
85 
     | 
    
         
             
                # * :as         - override the default type used (:url, :email, :phone, :password, :number, :text)
         
     | 
| 
       86 
86 
     | 
    
         
             
                # * :label      - override the default label used ('Name:', 'URL:', etc.)
         
     | 
| 
       87 
87 
     | 
    
         
             
                # * :error      - override the default error used ('invalid', 'incorrect', etc.)
         
     | 
| 
       88 
     | 
    
         
            -
                # * :input      - add custom options to the input ({ : 
     | 
| 
       89 
     | 
    
         
            -
                # * :container  - add custom options to the container ({ : 
     | 
| 
      
 88 
     | 
    
         
            +
                # * :input      - add custom options to the input ({ class: 'goregous' }, etc.)
         
     | 
| 
      
 89 
     | 
    
         
            +
                # * :container  - add custom options to the container ({ class: 'gorgeous' }, etc.)
         
     | 
| 
       90 
90 
     | 
    
         
             
                #
         
     | 
| 
       91 
91 
     | 
    
         
             
                # Usage:
         
     | 
| 
       92 
92 
     | 
    
         
             
                #
         
     | 
| 
       93 
93 
     | 
    
         
             
                #   f.input(:name)
         
     | 
| 
       94 
94 
     | 
    
         
             
                #   f.input(:email)
         
     | 
| 
       95 
     | 
    
         
            -
                #   f.input(:password_a, : 
     | 
| 
       96 
     | 
    
         
            -
                #   f.input(:password_b, : 
     | 
| 
      
 95 
     | 
    
         
            +
                #   f.input(:password_a, label: "Password", hint: "It's a secret!", container: { class: "half" })
         
     | 
| 
      
 96 
     | 
    
         
            +
                #   f.input(:password_b, label: "Password", hint: "It's a secret!", container: { class: "half" })
         
     | 
| 
       97 
97 
     | 
    
         
             
                #
         
     | 
| 
       98 
98 
     | 
    
         
             
                # Equivalent:
         
     | 
| 
       99 
99 
     | 
    
         
             
                #
         
     | 
| 
         @@ -164,14 +164,14 @@ module Formula 
     | 
|
| 
       164 
164 
     | 
    
         
             
                #
         
     | 
| 
       165 
165 
     | 
    
         
             
                # * :label       - override the default label used ('Name:', 'URL:', etc.)
         
     | 
| 
       166 
166 
     | 
    
         
             
                # * :error       - override the default error used ('invalid', 'incorrect', etc.)
         
     | 
| 
       167 
     | 
    
         
            -
                # * :association - add custom options to the input ({ : 
     | 
| 
       168 
     | 
    
         
            -
                # * :container   - add custom options to the container ({ : 
     | 
| 
      
 167 
     | 
    
         
            +
                # * :association - add custom options to the input ({ class: 'goregous' }, etc.)
         
     | 
| 
      
 168 
     | 
    
         
            +
                # * :container   - add custom options to the container ({ class: 'gorgeous' }, etc.)
         
     | 
| 
       169 
169 
     | 
    
         
             
                #
         
     | 
| 
       170 
170 
     | 
    
         
             
                # Usage:
         
     | 
| 
       171 
171 
     | 
    
         
             
                #
         
     | 
| 
       172 
     | 
    
         
            -
                #   f.association(:category, Category.all, :id, :name, : 
     | 
| 
       173 
     | 
    
         
            -
                #   f.association(:category, Category.all, :id, :name, : 
     | 
| 
       174 
     | 
    
         
            -
                #   f.association(:category, Category.all, :id, :name, : 
     | 
| 
      
 172 
     | 
    
         
            +
                #   f.association(:category, Category.all, :id, :name, hint: "What do you do?")
         
     | 
| 
      
 173 
     | 
    
         
            +
                #   f.association(:category, Category.all, :id, :name, association: { prompt: "Category?" })
         
     | 
| 
      
 174 
     | 
    
         
            +
                #   f.association(:category, Category.all, :id, :name, association: { html: { class: "category" } })
         
     | 
| 
       175 
175 
     | 
    
         
             
                #
         
     | 
| 
       176 
176 
     | 
    
         
             
                # Equivalent:
         
     | 
| 
       177 
177 
     | 
    
         
             
                #
         
     | 
| 
         @@ -189,7 +189,7 @@ module Formula 
     | 
|
| 
       189 
189 
     | 
    
         
             
                #     <div class="association category">
         
     | 
| 
       190 
190 
     | 
    
         
             
                #       <%= f.label(:category)
         
     | 
| 
       191 
191 
     | 
    
         
             
                #       <div class="association">
         
     | 
| 
       192 
     | 
    
         
            -
                #         <%= f.collection_select(:category, Category.all, :id, :name, { : 
     | 
| 
      
 192 
     | 
    
         
            +
                #         <%= f.collection_select(:category, Category.all, :id, :name, { prompt: "Category") } %>
         
     | 
| 
       193 
193 
     | 
    
         
             
                #       </div>
         
     | 
| 
       194 
194 
     | 
    
         
             
                #       <div class="error">...</div>
         
     | 
| 
       195 
195 
     | 
    
         
             
                #     </div>
         
     | 
| 
         @@ -198,7 +198,7 @@ module Formula 
     | 
|
| 
       198 
198 
     | 
    
         
             
                #     <div class="association category">
         
     | 
| 
       199 
199 
     | 
    
         
             
                #       <%= f.label(:category)
         
     | 
| 
       200 
200 
     | 
    
         
             
                #       <div class="association">
         
     | 
| 
       201 
     | 
    
         
            -
                #         <%= f.collection_select(:category, Category.all, :id, :name, {}, { : 
     | 
| 
      
 201 
     | 
    
         
            +
                #         <%= f.collection_select(:category, Category.all, :id, :name, {}, { class: "category" } %>
         
     | 
| 
       202 
202 
     | 
    
         
             
                #       </div>
         
     | 
| 
       203 
203 
     | 
    
         
             
                #       <div class="error">...</div>
         
     | 
| 
       204 
204 
     | 
    
         
             
                #     </div>
         
     | 
| 
         @@ -340,10 +340,10 @@ module Formula 
     | 
|
| 
       340 
340 
     | 
    
         
             
                #     <%= company_f.input :url %>
         
     | 
| 
       341 
341 
     | 
    
         
             
                #     <%= company_f.input :phone %>
         
     | 
| 
       342 
342 
     | 
    
         
             
                #   <% end %>
         
     | 
| 
       343 
     | 
    
         
            -
                def formula_fields_for(record_or_name_or_array, *args, & 
     | 
| 
      
 343 
     | 
    
         
            +
                def formula_fields_for(record_or_name_or_array, *args, &)
         
     | 
| 
       344 
344 
     | 
    
         
             
                  options = args.extract_options!
         
     | 
| 
       345 
345 
     | 
    
         
             
                  options[:builder] ||= self.class
         
     | 
| 
       346 
     | 
    
         
            -
                  fields_for(record_or_name_or_array, *(args << options), & 
     | 
| 
      
 346 
     | 
    
         
            +
                  fields_for(record_or_name_or_array, *(args << options), &)
         
     | 
| 
       347 
347 
     | 
    
         
             
                end
         
     | 
| 
       348 
348 
     | 
    
         | 
| 
       349 
349 
     | 
    
         
             
                alias fieldsula_for formula_fields_for
         
     | 
    
        data/lib/formula/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: formula
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kevin Sylvestre
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2024-10-31 00:00:00.000000000 Z
         
     | 
| 
         @@ -50,8 +50,6 @@ extra_rdoc_files: [] 
     | 
|
| 
       50 
50 
     | 
    
         
             
            files:
         
     | 
| 
       51 
51 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       52 
52 
     | 
    
         
             
            - README.md
         
     | 
| 
       53 
     | 
    
         
            -
            - bin/rubocop
         
     | 
| 
       54 
     | 
    
         
            -
            - bin/test
         
     | 
| 
       55 
53 
     | 
    
         
             
            - lib/formula.rb
         
     | 
| 
       56 
54 
     | 
    
         
             
            - lib/formula/config.rb
         
     | 
| 
       57 
55 
     | 
    
         
             
            - lib/formula/form_builder.rb
         
     | 
| 
         @@ -67,7 +65,7 @@ metadata: 
     | 
|
| 
       67 
65 
     | 
    
         
             
              homepage_uri: https://github.com/ksylvest/formula
         
     | 
| 
       68 
66 
     | 
    
         
             
              changelog_uri: https://github.com/ksylvest/formula/releases
         
     | 
| 
       69 
67 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       70 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 68 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       71 
69 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       72 
70 
     | 
    
         
             
            require_paths:
         
     | 
| 
       73 
71 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -82,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       82 
80 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       83 
81 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       84 
82 
     | 
    
         
             
            requirements: []
         
     | 
| 
       85 
     | 
    
         
            -
            rubygems_version: 3.5. 
     | 
| 
       86 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 83 
     | 
    
         
            +
            rubygems_version: 3.5.18
         
     | 
| 
      
 84 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       87 
85 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       88 
86 
     | 
    
         
             
            summary: A great way to simplify complex forms
         
     | 
| 
       89 
87 
     | 
    
         
             
            test_files: []
         
     | 
    
        data/bin/rubocop
    DELETED
    
    | 
         @@ -1,8 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
            require "rubygems"
         
     | 
| 
       3 
     | 
    
         
            -
            require "bundler/setup"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            # explicit rubocop config increases performance slightly while avoiding config confusion.
         
     | 
| 
       6 
     | 
    
         
            -
            ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            load Gem.bin_path("rubocop", "rubocop")
         
     |