hash_params 2.0.5 → 2.0.6
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/Gemfile.lock +38 -0
 - data/coverage/assets/0.10.2/application.css +799 -0
 - data/coverage/assets/0.10.2/application.js +1707 -0
 - data/coverage/assets/0.10.2/colorbox/border.png +0 -0
 - data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
 - data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
 - data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
 - data/coverage/assets/0.10.2/favicon_green.png +0 -0
 - data/coverage/assets/0.10.2/favicon_red.png +0 -0
 - data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
 - data/coverage/assets/0.10.2/loading.gif +0 -0
 - data/coverage/assets/0.10.2/magnify.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
 - data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
 - data/coverage/index.html +72 -0
 - data/hash_params-2.0.5.gem +0 -0
 - data/lib/hash_params.rb +2 -2
 - data/lib/hash_params/validator.rb +6 -1
 - metadata +30 -3
 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
    
        data/coverage/index.html
    ADDED
    
    | 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!DOCTYPE html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html xmlns='http://www.w3.org/1999/xhtml'>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <title>Code coverage for Hash params</title>
         
     | 
| 
      
 5 
     | 
    
         
            +
                <meta http-equiv="content-type" content="text/html; charset=utf-8" />
         
     | 
| 
      
 6 
     | 
    
         
            +
                <script src='./assets/0.10.2/application.js' type='text/javascript'></script>    
         
     | 
| 
      
 7 
     | 
    
         
            +
                <link href='./assets/0.10.2/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <link rel="shortcut icon" type="image/png" href="./assets/0.10.2/favicon_green.png" />
         
     | 
| 
      
 9 
     | 
    
         
            +
                <link rel="icon" type="image/png" href="./assets/0.10.2/favicon.png" />
         
     | 
| 
      
 10 
     | 
    
         
            +
              </head>
         
     | 
| 
      
 11 
     | 
    
         
            +
              
         
     | 
| 
      
 12 
     | 
    
         
            +
              <body>
         
     | 
| 
      
 13 
     | 
    
         
            +
                <div id="loading">
         
     | 
| 
      
 14 
     | 
    
         
            +
                  <img src="./assets/0.10.2/loading.gif" alt="loading"/>
         
     | 
| 
      
 15 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 16 
     | 
    
         
            +
                <div id="wrapper" style="display:none;">
         
     | 
| 
      
 17 
     | 
    
         
            +
                  <div class="timestamp">Generated <abbr class="timeago" title="2017-10-10T20:47:47+13:00">2017-10-10T20:47:47+13:00</abbr></div>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  <ul class="group_tabs"></ul>
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  <div id="content">
         
     | 
| 
      
 21 
     | 
    
         
            +
                    <div class="file_list_container" id="AllFiles">
         
     | 
| 
      
 22 
     | 
    
         
            +
              <h2>
         
     | 
| 
      
 23 
     | 
    
         
            +
                <span class="group_name">All Files</span>
         
     | 
| 
      
 24 
     | 
    
         
            +
                (<span class="covered_percent"><span class="green">100.0%</span></span>
         
     | 
| 
      
 25 
     | 
    
         
            +
                 covered at
         
     | 
| 
      
 26 
     | 
    
         
            +
                 <span class="covered_strength">
         
     | 
| 
      
 27 
     | 
    
         
            +
                   <span class="red">
         
     | 
| 
      
 28 
     | 
    
         
            +
                     0.0
         
     | 
| 
      
 29 
     | 
    
         
            +
                   </span>
         
     | 
| 
      
 30 
     | 
    
         
            +
                </span> hits/line)
         
     | 
| 
      
 31 
     | 
    
         
            +
              </h2>
         
     | 
| 
      
 32 
     | 
    
         
            +
              <a name="AllFiles"></a>
         
     | 
| 
      
 33 
     | 
    
         
            +
              <div>
         
     | 
| 
      
 34 
     | 
    
         
            +
                <b>0</b> files in total.
         
     | 
| 
      
 35 
     | 
    
         
            +
                <b>0.0</b> relevant lines. 
         
     | 
| 
      
 36 
     | 
    
         
            +
                <span class="green"><b>0.0</b> lines covered</span> and
         
     | 
| 
      
 37 
     | 
    
         
            +
                <span class="red"><b>0.0</b> lines missed </span>
         
     | 
| 
      
 38 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 39 
     | 
    
         
            +
              <table class="file_list">
         
     | 
| 
      
 40 
     | 
    
         
            +
                <thead>
         
     | 
| 
      
 41 
     | 
    
         
            +
                  <tr>
         
     | 
| 
      
 42 
     | 
    
         
            +
                    <th>File</th>
         
     | 
| 
      
 43 
     | 
    
         
            +
                    <th>% covered</th>
         
     | 
| 
      
 44 
     | 
    
         
            +
                    <th>Lines</th>
         
     | 
| 
      
 45 
     | 
    
         
            +
                    <th>Relevant Lines</th>
         
     | 
| 
      
 46 
     | 
    
         
            +
                    <th>Lines covered</th>
         
     | 
| 
      
 47 
     | 
    
         
            +
                    <th>Lines missed</th>
         
     | 
| 
      
 48 
     | 
    
         
            +
                    <th>Avg. Hits / Line</th>
         
     | 
| 
      
 49 
     | 
    
         
            +
                  </tr>
         
     | 
| 
      
 50 
     | 
    
         
            +
                </thead>
         
     | 
| 
      
 51 
     | 
    
         
            +
                <tbody>
         
     | 
| 
      
 52 
     | 
    
         
            +
                  
         
     | 
| 
      
 53 
     | 
    
         
            +
                </tbody>
         
     | 
| 
      
 54 
     | 
    
         
            +
              </table>
         
     | 
| 
      
 55 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                    
         
     | 
| 
      
 59 
     | 
    
         
            +
                  </div>
         
     | 
| 
      
 60 
     | 
    
         
            +
                
         
     | 
| 
      
 61 
     | 
    
         
            +
                  <div id="footer">
         
     | 
| 
      
 62 
     | 
    
         
            +
                    Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.15.1 
         
     | 
| 
      
 63 
     | 
    
         
            +
                    and simplecov-html v0.10.2<br/>
         
     | 
| 
      
 64 
     | 
    
         
            +
                    using RSpec
         
     | 
| 
      
 65 
     | 
    
         
            +
                  </div>
         
     | 
| 
      
 66 
     | 
    
         
            +
                
         
     | 
| 
      
 67 
     | 
    
         
            +
                  <div class="source_files">
         
     | 
| 
      
 68 
     | 
    
         
            +
                  
         
     | 
| 
      
 69 
     | 
    
         
            +
                  </div>
         
     | 
| 
      
 70 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 71 
     | 
    
         
            +
              </body>
         
     | 
| 
      
 72 
     | 
    
         
            +
            </html>
         
     | 
| 
         Binary file 
     | 
    
        data/lib/hash_params.rb
    CHANGED
    
    | 
         @@ -7,8 +7,8 @@ require_relative 'hash_params/validator' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            require_relative 'hash_params/binding_validator'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            module HashParams
         
     | 
| 
       10 
     | 
    
         
            -
              ENVIRONMENT =  ENV['HASH_PARAMS_ENV'] || (defined?(Rails) && Rails.env) || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
         
     | 
| 
       11 
     | 
    
         
            -
              VERSION = '2.0. 
     | 
| 
      
 10 
     | 
    
         
            +
              ENVIRONMENT =  ENV['HASH_PARAMS_ENV'] || (defined?(Rails) && Rails.env) || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['APP_ENV'] || 'development'
         
     | 
| 
      
 11 
     | 
    
         
            +
              VERSION = '2.0.6'
         
     | 
| 
       12 
12 
     | 
    
         
             
              extend HashParams::Validator
         
     | 
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
         @@ -24,6 +24,11 @@ module HashParams 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    param = validations.delete(:validate).call(param)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
      
 27 
     | 
    
         
            +
                  #don't bother with the rest if required parameter is missing
         
     | 
| 
      
 28 
     | 
    
         
            +
                  if validations[:required] && param.nil?
         
     | 
| 
      
 29 
     | 
    
         
            +
                    raise ValidationError.new('Required Parameter missing and has no default specified')
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       27 
32 
     | 
    
         
             
                  if block_given? && !param.is_a?(Hash)
         
     | 
| 
       28 
33 
     | 
    
         
             
                    param = yield(param, validations)
         
     | 
| 
       29 
34 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -70,7 +75,7 @@ module HashParams 
     | 
|
| 
       70 
75 
     | 
    
         
             
                                nil
         
     | 
| 
       71 
76 
     | 
    
         
             
                            end
         
     | 
| 
       72 
77 
     | 
    
         
             
                  end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
      
 78 
     | 
    
         
            +
                  error = validations[:errmsg] || error
         
     | 
| 
       74 
79 
     | 
    
         
             
                  raise ValidationError.new(error) if error
         
     | 
| 
       75 
80 
     | 
    
         
             
                  param
         
     | 
| 
       76 
81 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hash_params
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tim Uckun
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-10-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
         @@ -89,9 +89,36 @@ extensions: [] 
     | 
|
| 
       89 
89 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       90 
90 
     | 
    
         
             
            files:
         
     | 
| 
       91 
91 
     | 
    
         
             
            - "./Gemfile"
         
     | 
| 
      
 92 
     | 
    
         
            +
            - "./Gemfile.lock"
         
     | 
| 
       92 
93 
     | 
    
         
             
            - "./LICENSE"
         
     | 
| 
       93 
94 
     | 
    
         
             
            - "./README.md"
         
     | 
| 
       94 
95 
     | 
    
         
             
            - "./Rakefile"
         
     | 
| 
      
 96 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/application.css"
         
     | 
| 
      
 97 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/application.js"
         
     | 
| 
      
 98 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/colorbox/border.png"
         
     | 
| 
      
 99 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/colorbox/controls.png"
         
     | 
| 
      
 100 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/colorbox/loading.gif"
         
     | 
| 
      
 101 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/colorbox/loading_background.png"
         
     | 
| 
      
 102 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/favicon_green.png"
         
     | 
| 
      
 103 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/favicon_red.png"
         
     | 
| 
      
 104 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/favicon_yellow.png"
         
     | 
| 
      
 105 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/loading.gif"
         
     | 
| 
      
 106 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/magnify.png"
         
     | 
| 
      
 107 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png"
         
     | 
| 
      
 108 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png"
         
     | 
| 
      
 109 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png"
         
     | 
| 
      
 110 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png"
         
     | 
| 
      
 111 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png"
         
     | 
| 
      
 112 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png"
         
     | 
| 
      
 113 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png"
         
     | 
| 
      
 114 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png"
         
     | 
| 
      
 115 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png"
         
     | 
| 
      
 116 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png"
         
     | 
| 
      
 117 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png"
         
     | 
| 
      
 118 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png"
         
     | 
| 
      
 119 
     | 
    
         
            +
            - "./coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png"
         
     | 
| 
      
 120 
     | 
    
         
            +
            - "./coverage/index.html"
         
     | 
| 
      
 121 
     | 
    
         
            +
            - "./hash_params-2.0.5.gem"
         
     | 
| 
       95 
122 
     | 
    
         
             
            - "./hash_params.gemspec"
         
     | 
| 
       96 
123 
     | 
    
         
             
            - "./lib/hash_params.rb"
         
     | 
| 
       97 
124 
     | 
    
         
             
            - "./lib/hash_params/binding_validator.rb"
         
     | 
| 
         @@ -120,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       120 
147 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       121 
148 
     | 
    
         
             
            requirements: []
         
     | 
| 
       122 
149 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       123 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 150 
     | 
    
         
            +
            rubygems_version: 2.6.11
         
     | 
| 
       124 
151 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       125 
152 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       126 
153 
     | 
    
         
             
            summary: Parameter Validation & Type Coercion for parameters passed in as a Hash..
         
     |