action_form 0.2.2 → 0.3.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
 - data/lib/action_form/schema_dsl.rb +15 -2
 - data/lib/action_form/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 93e16fca08cba7ced7cf05dfe08e026f45d9ed6fd03d1210de7b82959ee13c13
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 21034909b984567b9ba419474c8afc296b44c86543d881881b69f2600560743d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 16162478587b84ae6cdccbc3d3f62c01c7b1c9fe2657e8f1f1ec3486df05f30d45798c46700c7790d49c68b8cade708d730dfbea2f57726e1d5e472ed87b9d78
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 064b00adb4bffe1b124eaf2e0e12f14028fb50648e161a98cfe933c9e19207b40f6e59fa69134018d1a540dce11c7c383a7ccc2781738a6b9aebd7097e9b49c4
         
     | 
| 
         @@ -13,7 +13,16 @@ module ActionForm 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    EasyParams::Base
         
     | 
| 
       14 
14 
     | 
    
         
             
                  end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                  def params_definition(*) 
     | 
| 
      
 16 
     | 
    
         
            +
                  def params_definition(*)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @params_definition ||= create_params_definition
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  def params(&block)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @params_definition = create_params_definition(&block)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @params_definition.class_eval(&block) if block
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  def create_params_definition # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       17 
26 
     | 
    
         
             
                    schema = Class.new(params_class)
         
     | 
| 
       18 
27 
     | 
    
         
             
                    elements.each do |name, element_definition|
         
     | 
| 
       19 
28 
     | 
    
         
             
                      if element_definition < ActionForm::SubformsCollection
         
     | 
| 
         @@ -40,7 +49,11 @@ module ActionForm 
     | 
|
| 
       40 
49 
     | 
    
         
             
                end
         
     | 
| 
       41 
50 
     | 
    
         | 
| 
       42 
51 
     | 
    
         
             
                module InstanceMethods # rubocop:disable Style/Documentation
         
     | 
| 
       43 
     | 
    
         
            -
                  def params_definition(*) 
     | 
| 
      
 52 
     | 
    
         
            +
                  def params_definition(*)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    @params_definition ||= create_params_definition
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  def create_params_definition # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       44 
57 
     | 
    
         
             
                    schema = Class.new(self.class.params_class)
         
     | 
| 
       45 
58 
     | 
    
         
             
                    elements_instances.select(&:render?).each do |element|
         
     | 
| 
       46 
59 
     | 
    
         
             
                      case element
         
     | 
    
        data/lib/action_form/version.rb
    CHANGED