./coverage/index.html in sinatra-param-1.4.0 vs ./coverage/index.html in sinatra-param-1.5.0
- old
+ new
@@ -1,41 +1,41 @@
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Code coverage for Sinatra-param</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
- <link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
- <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_green.png" />
- <link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
+ <script src='./assets/0.10.2/application.js' type='text/javascript'></script>
+ <link href='./assets/0.10.2/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
+ <link rel="shortcut icon" type="image/png" href="./assets/0.10.2/favicon_green.png" />
+ <link rel="icon" type="image/png" href="./assets/0.10.2/favicon.png" />
</head>
<body>
<div id="loading">
- <img src="./assets/0.7.1/loading.gif" alt="loading"/>
+ <img src="./assets/0.10.2/loading.gif" alt="loading"/>
</div>
<div id="wrapper" style="display:none;">
- <div class="timestamp">Generated <abbr class="timeago" title="2015-04-21T07:40:09-07:00">2015-04-21T07:40:09-07:00</abbr></div>
+ <div class="timestamp">Generated <abbr class="timeago" title="2018-03-20T09:45:02-07:00">2018-03-20T09:45:02-07:00</abbr></div>
<ul class="group_tabs"></ul>
<div id="content">
<div class="file_list_container" id="AllFiles">
<h2>
<span class="group_name">All Files</span>
(<span class="covered_percent"><span class="green">100.0%</span></span>
covered at
<span class="covered_strength">
<span class="green">
- 21.4
+ 22.7
</span>
</span> hits/line)
</h2>
<a name="AllFiles"></a>
<div>
<b>1</b> files in total.
- <b>96</b> relevant lines.
- <span class="green"><b>96</b> lines covered</span> and
+ <b>98</b> relevant lines.
+ <span class="green"><b>98</b> lines covered</span> and
<span class="red"><b>0</b> lines missed </span>
</div>
<table class="file_list">
<thead>
<tr>
@@ -51,15 +51,15 @@
<tbody>
<tr>
<td class="strong"><a href="#0f7926ededdfd8418773c107837b6dc4182659b8" class="src_link" title="lib/sinatra/param.rb">lib/sinatra/param.rb</a></td>
<td class="green strong">100.0 %</td>
- <td>164</td>
- <td>96</td>
- <td>96</td>
+ <td>167</td>
+ <td>98</td>
+ <td>98</td>
<td>0</td>
- <td>21.4</td>
+ <td>22.7</td>
</tr>
</tbody>
</table>
</div>
@@ -67,24 +67,24 @@
</div>
<div id="footer">
- Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
- and simplecov-html v0.7.1<br/>
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.16.1
+ and simplecov-html v0.10.2<br/>
using RSpec
</div>
<div class="source_files">
<div class="source_table" id="0f7926ededdfd8418773c107837b6dc4182659b8">
<div class="header">
<h3>lib/sinatra/param.rb</h3>
<h4><span class="green">100.0 %</span> covered</h4>
<div>
- <b>96</b> relevant lines.
- <span class="green"><b>96</b> lines covered</span> and
+ <b>98</b> relevant lines.
+ <span class="green"><b>98</b> lines covered</span> and
<span class="red"><b>0</b> lines missed.</span>
</div>
</div>
<pre>
@@ -172,912 +172,931 @@
<span class="hits">1</span>
<code class="ruby"> def param(name, type, options = {})</code>
</li>
- <li class="covered" data-hits="147" data-linenumber="15">
- <span class="hits">147</span>
+ <li class="covered" data-hits="152" data-linenumber="15">
+ <span class="hits">152</span>
<code class="ruby"> name = name.to_s</code>
</li>
<li class="never" data-hits="" data-linenumber="16">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="147" data-linenumber="17">
- <span class="hits">147</span>
+ <li class="covered" data-hits="152" data-linenumber="17">
+ <span class="hits">152</span>
- <code class="ruby"> return unless params.member?(name) or options[:default] or options[:required]</code>
+ <code class="ruby"> return unless params.member?(name) or options.has_key?(:default) or options[:required]</code>
</li>
<li class="never" data-hits="" data-linenumber="18">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="102" data-linenumber="19">
- <span class="hits">102</span>
+ <li class="covered" data-hits="107" data-linenumber="19">
+ <span class="hits">107</span>
<code class="ruby"> begin</code>
</li>
- <li class="covered" data-hits="102" data-linenumber="20">
- <span class="hits">102</span>
+ <li class="covered" data-hits="107" data-linenumber="20">
+ <span class="hits">107</span>
<code class="ruby"> params[name] = coerce(params[name], type, options)</code>
</li>
- <li class="covered" data-hits="97" data-linenumber="21">
- <span class="hits">97</span>
+ <li class="covered" data-hits="102" data-linenumber="21">
+ <span class="hits">102</span>
- <code class="ruby"> params[name] = (options[:default].call if options[:default].respond_to?(:call)) || options[:default] if params[name].nil? and options[:default]</code>
+ <code class="ruby"> params[name] = (options[:default].call if options[:default].respond_to?(:call)) || options[:default] if params[name].nil? and options.has_key?(:default)</code>
</li>
- <li class="covered" data-hits="97" data-linenumber="22">
- <span class="hits">97</span>
+ <li class="covered" data-hits="102" data-linenumber="22">
+ <span class="hits">102</span>
<code class="ruby"> params[name] = options[:transform].to_proc.call(params[name]) if params[name] and options[:transform]</code>
</li>
- <li class="covered" data-hits="97" data-linenumber="23">
- <span class="hits">97</span>
+ <li class="covered" data-hits="102" data-linenumber="23">
+ <span class="hits">102</span>
<code class="ruby"> validate!(params[name], options)</code>
</li>
- <li class="covered" data-hits="22" data-linenumber="24">
- <span class="hits">22</span>
+ <li class="covered" data-hits="82" data-linenumber="24">
+ <span class="hits">82</span>
+ <code class="ruby"> params[name]</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="25">
+ <span class="hits">25</span>
+
<code class="ruby"> rescue InvalidParameterError => exception</code>
</li>
- <li class="covered" data-hits="22" data-linenumber="25">
- <span class="hits">22</span>
+ <li class="covered" data-hits="25" data-linenumber="26">
+ <span class="hits">25</span>
<code class="ruby"> if options[:raise] or (settings.raise_sinatra_param_exceptions rescue false)</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="26">
+ <li class="covered" data-hits="1" data-linenumber="27">
<span class="hits">1</span>
<code class="ruby"> exception.param, exception.options = name, options</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="27">
+ <li class="covered" data-hits="1" data-linenumber="28">
<span class="hits">1</span>
<code class="ruby"> raise exception</code>
</li>
- <li class="never" data-hits="" data-linenumber="28">
+ <li class="never" data-hits="" data-linenumber="29">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="29">
+ <li class="never" data-hits="" data-linenumber="30">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="21" data-linenumber="30">
- <span class="hits">21</span>
+ <li class="covered" data-hits="24" data-linenumber="31">
+ <span class="hits">24</span>
- <code class="ruby"> error = exception.to_s</code>
+ <code class="ruby"> error = options[:message] || exception.to_s</code>
</li>
- <li class="never" data-hits="" data-linenumber="31">
+ <li class="never" data-hits="" data-linenumber="32">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="21" data-linenumber="32">
- <span class="hits">21</span>
+ <li class="covered" data-hits="24" data-linenumber="33">
+ <span class="hits">24</span>
<code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
</li>
- <li class="covered" data-hits="21" data-linenumber="33">
- <span class="hits">21</span>
+ <li class="covered" data-hits="23" data-linenumber="34">
+ <span class="hits">23</span>
<code class="ruby"> error = {message: error, errors: {name => exception.message}}.to_json</code>
</li>
- <li class="never" data-hits="" data-linenumber="34">
+ <li class="never" data-hits="" data-linenumber="35">
+ <code class="ruby"> else</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <code class="ruby"> content_type 'text/plain'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="35">
+ <li class="never" data-hits="" data-linenumber="38">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="21" data-linenumber="36">
- <span class="hits">21</span>
+ <li class="covered" data-hits="24" data-linenumber="39">
+ <span class="hits">24</span>
<code class="ruby"> halt 400, error</code>
</li>
- <li class="never" data-hits="" data-linenumber="37">
+ <li class="never" data-hits="" data-linenumber="40">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="38">
+ <li class="never" data-hits="" data-linenumber="41">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="39">
+ <li class="never" data-hits="" data-linenumber="42">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="40">
+ <li class="covered" data-hits="1" data-linenumber="43">
<span class="hits">1</span>
<code class="ruby"> def one_of(*args)</code>
</li>
- <li class="covered" data-hits="17" data-linenumber="41">
+ <li class="covered" data-hits="17" data-linenumber="44">
<span class="hits">17</span>
<code class="ruby"> options = args.last.is_a?(Hash) ? args.pop : {}</code>
</li>
- <li class="covered" data-hits="17" data-linenumber="42">
+ <li class="covered" data-hits="17" data-linenumber="45">
<span class="hits">17</span>
<code class="ruby"> names = args.collect(&:to_s)</code>
</li>
- <li class="never" data-hits="" data-linenumber="43">
+ <li class="never" data-hits="" data-linenumber="46">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="17" data-linenumber="44">
+ <li class="covered" data-hits="17" data-linenumber="47">
<span class="hits">17</span>
<code class="ruby"> return unless names.length >= 2</code>
</li>
- <li class="never" data-hits="" data-linenumber="45">
+ <li class="never" data-hits="" data-linenumber="48">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="13" data-linenumber="46">
+ <li class="covered" data-hits="13" data-linenumber="49">
<span class="hits">13</span>
<code class="ruby"> begin</code>
</li>
- <li class="covered" data-hits="13" data-linenumber="47">
+ <li class="covered" data-hits="13" data-linenumber="50">
<span class="hits">13</span>
<code class="ruby"> validate_one_of!(params, names, options)</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="48">
+ <li class="covered" data-hits="5" data-linenumber="51">
<span class="hits">5</span>
<code class="ruby"> rescue InvalidParameterError => exception</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="49">
+ <li class="covered" data-hits="5" data-linenumber="52">
<span class="hits">5</span>
<code class="ruby"> if options[:raise] or (settings.raise_sinatra_param_exceptions rescue false)</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="50">
+ <li class="covered" data-hits="1" data-linenumber="53">
<span class="hits">1</span>
<code class="ruby"> exception.param, exception.options = names, options</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="51">
+ <li class="covered" data-hits="1" data-linenumber="54">
<span class="hits">1</span>
<code class="ruby"> raise exception</code>
</li>
- <li class="never" data-hits="" data-linenumber="52">
+ <li class="never" data-hits="" data-linenumber="55">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="53">
+ <li class="never" data-hits="" data-linenumber="56">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="4" data-linenumber="54">
+ <li class="covered" data-hits="4" data-linenumber="57">
<span class="hits">4</span>
<code class="ruby"> error = "Invalid parameters [#{names.join(', ')}]"</code>
</li>
- <li class="covered" data-hits="4" data-linenumber="55">
+ <li class="covered" data-hits="4" data-linenumber="58">
<span class="hits">4</span>
<code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
</li>
- <li class="covered" data-hits="4" data-linenumber="56">
+ <li class="covered" data-hits="4" data-linenumber="59">
<span class="hits">4</span>
<code class="ruby"> error = {message: error, errors: {names => exception.message}}.to_json</code>
</li>
- <li class="never" data-hits="" data-linenumber="57">
+ <li class="never" data-hits="" data-linenumber="60">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="58">
+ <li class="never" data-hits="" data-linenumber="61">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="4" data-linenumber="59">
+ <li class="covered" data-hits="4" data-linenumber="62">
<span class="hits">4</span>
<code class="ruby"> halt 400, error</code>
</li>
- <li class="never" data-hits="" data-linenumber="60">
+ <li class="never" data-hits="" data-linenumber="63">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="61">
+ <li class="never" data-hits="" data-linenumber="64">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="62">
+ <li class="never" data-hits="" data-linenumber="65">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="63">
+ <li class="covered" data-hits="1" data-linenumber="66">
<span class="hits">1</span>
<code class="ruby"> def any_of(*args)</code>
</li>
- <li class="covered" data-hits="8" data-linenumber="64">
+ <li class="covered" data-hits="8" data-linenumber="67">
<span class="hits">8</span>
<code class="ruby"> options = args.last.is_a?(Hash) ? args.pop : {}</code>
</li>
- <li class="covered" data-hits="8" data-linenumber="65">
+ <li class="covered" data-hits="8" data-linenumber="68">
<span class="hits">8</span>
<code class="ruby"> names = args.collect(&:to_s)</code>
</li>
- <li class="never" data-hits="" data-linenumber="66">
+ <li class="never" data-hits="" data-linenumber="69">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="8" data-linenumber="67">
+ <li class="covered" data-hits="8" data-linenumber="70">
<span class="hits">8</span>
<code class="ruby"> return unless names.length >= 2</code>
</li>
- <li class="never" data-hits="" data-linenumber="68">
+ <li class="never" data-hits="" data-linenumber="71">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="8" data-linenumber="69">
+ <li class="covered" data-hits="8" data-linenumber="72">
<span class="hits">8</span>
<code class="ruby"> begin</code>
</li>
- <li class="covered" data-hits="8" data-linenumber="70">
+ <li class="covered" data-hits="8" data-linenumber="73">
<span class="hits">8</span>
<code class="ruby"> validate_any_of!(params, names, options)</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="71">
+ <li class="covered" data-hits="2" data-linenumber="74">
<span class="hits">2</span>
<code class="ruby"> rescue InvalidParameterError => exception</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="72">
+ <li class="covered" data-hits="2" data-linenumber="75">
<span class="hits">2</span>
<code class="ruby"> if options[:raise] or (settings.raise_sinatra_param_exceptions rescue false)</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="73">
+ <li class="covered" data-hits="1" data-linenumber="76">
<span class="hits">1</span>
<code class="ruby"> exception.param, exception.options = names, options</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="74">
+ <li class="covered" data-hits="1" data-linenumber="77">
<span class="hits">1</span>
<code class="ruby"> raise exception</code>
</li>
- <li class="never" data-hits="" data-linenumber="75">
+ <li class="never" data-hits="" data-linenumber="78">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="76">
+ <li class="never" data-hits="" data-linenumber="79">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="77">
+ <li class="covered" data-hits="1" data-linenumber="80">
<span class="hits">1</span>
<code class="ruby"> error = "Invalid parameters [#{names.join(', ')}]"</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="78">
+ <li class="covered" data-hits="1" data-linenumber="81">
<span class="hits">1</span>
<code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="79">
+ <li class="covered" data-hits="1" data-linenumber="82">
<span class="hits">1</span>
<code class="ruby"> error = {message: error, errors: {names => exception.message}}.to_json</code>
</li>
- <li class="never" data-hits="" data-linenumber="80">
+ <li class="never" data-hits="" data-linenumber="83">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="81">
+ <li class="never" data-hits="" data-linenumber="84">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="82">
+ <li class="covered" data-hits="1" data-linenumber="85">
<span class="hits">1</span>
<code class="ruby"> halt 400, error</code>
</li>
- <li class="never" data-hits="" data-linenumber="83">
+ <li class="never" data-hits="" data-linenumber="86">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="84">
+ <li class="never" data-hits="" data-linenumber="87">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="85">
+ <li class="never" data-hits="" data-linenumber="88">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="86">
+ <li class="covered" data-hits="1" data-linenumber="89">
<span class="hits">1</span>
<code class="ruby"> private</code>
</li>
- <li class="never" data-hits="" data-linenumber="87">
+ <li class="never" data-hits="" data-linenumber="90">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="88">
+ <li class="covered" data-hits="1" data-linenumber="91">
<span class="hits">1</span>
<code class="ruby"> def coerce(param, type, options = {})</code>
</li>
- <li class="covered" data-hits="102" data-linenumber="89">
- <span class="hits">102</span>
+ <li class="covered" data-hits="107" data-linenumber="92">
+ <span class="hits">107</span>
<code class="ruby"> begin</code>
</li>
- <li class="covered" data-hits="102" data-linenumber="90">
- <span class="hits">102</span>
+ <li class="covered" data-hits="107" data-linenumber="93">
+ <span class="hits">107</span>
<code class="ruby"> return nil if param.nil?</code>
</li>
- <li class="covered" data-hits="95" data-linenumber="91">
- <span class="hits">95</span>
+ <li class="covered" data-hits="96" data-linenumber="94">
+ <span class="hits">96</span>
<code class="ruby"> return param if (param.is_a?(type) rescue false)</code>
</li>
- <li class="covered" data-hits="46" data-linenumber="92">
+ <li class="covered" data-hits="46" data-linenumber="95">
<span class="hits">46</span>
<code class="ruby"> return Integer(param) if type == Integer</code>
</li>
- <li class="covered" data-hits="35" data-linenumber="93">
+ <li class="covered" data-hits="35" data-linenumber="96">
<span class="hits">35</span>
<code class="ruby"> return Float(param) if type == Float</code>
</li>
- <li class="covered" data-hits="33" data-linenumber="94">
+ <li class="covered" data-hits="33" data-linenumber="97">
<span class="hits">33</span>
<code class="ruby"> return String(param) if type == String</code>
</li>
- <li class="covered" data-hits="32" data-linenumber="95">
+ <li class="covered" data-hits="32" data-linenumber="98">
<span class="hits">32</span>
<code class="ruby"> return Date.parse(param) if type == Date</code>
</li>
- <li class="covered" data-hits="30" data-linenumber="96">
+ <li class="covered" data-hits="30" data-linenumber="99">
<span class="hits">30</span>
<code class="ruby"> return Time.parse(param) if type == Time</code>
</li>
- <li class="covered" data-hits="28" data-linenumber="97">
+ <li class="covered" data-hits="28" data-linenumber="100">
<span class="hits">28</span>
<code class="ruby"> return DateTime.parse(param) if type == DateTime</code>
</li>
- <li class="covered" data-hits="26" data-linenumber="98">
+ <li class="covered" data-hits="26" data-linenumber="101">
<span class="hits">26</span>
<code class="ruby"> return Array(param.split(options[:delimiter] || ",")) if type == Array</code>
</li>
- <li class="covered" data-hits="25" data-linenumber="99">
+ <li class="covered" data-hits="25" data-linenumber="102">
<span class="hits">25</span>
<code class="ruby"> return Hash[param.split(options[:delimiter] || ",").map{|c| c.split(options[:separator] || ":")}] if type == Hash</code>
</li>
- <li class="covered" data-hits="21" data-linenumber="100">
+ <li class="covered" data-hits="21" data-linenumber="103">
<span class="hits">21</span>
<code class="ruby"> return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type == Boolean</code>
</li>
- <li class="never" data-hits="" data-linenumber="101">
+ <li class="never" data-hits="" data-linenumber="104">
<code class="ruby"> return nil</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="102">
+ <li class="covered" data-hits="5" data-linenumber="105">
<span class="hits">5</span>
<code class="ruby"> rescue ArgumentError</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="103">
+ <li class="covered" data-hits="5" data-linenumber="106">
<span class="hits">5</span>
<code class="ruby"> raise InvalidParameterError, "'#{param}' is not a valid #{type}"</code>
</li>
- <li class="never" data-hits="" data-linenumber="104">
+ <li class="never" data-hits="" data-linenumber="107">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="105">
+ <li class="never" data-hits="" data-linenumber="108">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="106">
+ <li class="never" data-hits="" data-linenumber="109">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="107">
+ <li class="covered" data-hits="1" data-linenumber="110">
<span class="hits">1</span>
<code class="ruby"> def validate!(param, options)</code>
</li>
- <li class="covered" data-hits="97" data-linenumber="108">
- <span class="hits">97</span>
+ <li class="covered" data-hits="102" data-linenumber="111">
+ <span class="hits">102</span>
<code class="ruby"> options.each do |key, value|</code>
</li>
- <li class="covered" data-hits="45" data-linenumber="109">
- <span class="hits">45</span>
+ <li class="covered" data-hits="52" data-linenumber="112">
+ <span class="hits">52</span>
<code class="ruby"> case key</code>
</li>
- <li class="never" data-hits="" data-linenumber="110">
+ <li class="never" data-hits="" data-linenumber="113">
<code class="ruby"> when :required</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="111">
- <span class="hits">5</span>
+ <li class="covered" data-hits="7" data-linenumber="114">
+ <span class="hits">7</span>
<code class="ruby"> raise InvalidParameterError, "Parameter is required" if value && param.nil?</code>
</li>
- <li class="never" data-hits="" data-linenumber="112">
+ <li class="never" data-hits="" data-linenumber="115">
<code class="ruby"> when :blank</code>
</li>
- <li class="never" data-hits="" data-linenumber="113">
+ <li class="never" data-hits="" data-linenumber="116">
<code class="ruby"> raise InvalidParameterError, "Parameter cannot be blank" if !value && case param</code>
</li>
- <li class="never" data-hits="" data-linenumber="114">
+ <li class="never" data-hits="" data-linenumber="117">
<code class="ruby"> when String</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="115">
+ <li class="covered" data-hits="1" data-linenumber="118">
<span class="hits">1</span>
<code class="ruby"> !(/\S/ === param)</code>
</li>
- <li class="never" data-hits="" data-linenumber="116">
+ <li class="never" data-hits="" data-linenumber="119">
<code class="ruby"> when Array, Hash</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="117">
+ <li class="covered" data-hits="2" data-linenumber="120">
<span class="hits">2</span>
<code class="ruby"> param.empty?</code>
</li>
- <li class="never" data-hits="" data-linenumber="118">
+ <li class="never" data-hits="" data-linenumber="121">
<code class="ruby"> else</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="119">
+ <li class="covered" data-hits="1" data-linenumber="122">
<span class="hits">1</span>
<code class="ruby"> param.nil?</code>
</li>
- <li class="covered" data-hits="5" data-linenumber="120">
+ <li class="covered" data-hits="5" data-linenumber="123">
<span class="hits">5</span>
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="121">
+ <li class="never" data-hits="" data-linenumber="124">
<code class="ruby"> when :format</code>
</li>
- <li class="covered" data-hits="3" data-linenumber="122">
+ <li class="covered" data-hits="3" data-linenumber="125">
<span class="hits">3</span>
<code class="ruby"> raise InvalidParameterError, "Parameter must be a string if using the format validation" unless param.kind_of?(String)</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="123">
+ <li class="covered" data-hits="2" data-linenumber="126">
<span class="hits">2</span>
<code class="ruby"> raise InvalidParameterError, "Parameter must match format #{value}" unless param =~ value</code>
</li>
- <li class="never" data-hits="" data-linenumber="124">
+ <li class="never" data-hits="" data-linenumber="127">
<code class="ruby"> when :is</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="125">
+ <li class="covered" data-hits="2" data-linenumber="128">
<span class="hits">2</span>
<code class="ruby"> raise InvalidParameterError, "Parameter must be #{value}" unless param === value</code>
</li>
- <li class="never" data-hits="" data-linenumber="126">
+ <li class="never" data-hits="" data-linenumber="129">
<code class="ruby"> when :in, :within, :range</code>
</li>
- <li class="never" data-hits="" data-linenumber="127">
+ <li class="never" data-hits="" data-linenumber="130">
<code class="ruby"> raise InvalidParameterError, "Parameter must be within #{value}" unless param.nil? || case value</code>
</li>
- <li class="never" data-hits="" data-linenumber="128">
+ <li class="never" data-hits="" data-linenumber="131">
<code class="ruby"> when Range</code>
</li>
- <li class="covered" data-hits="4" data-linenumber="129">
+ <li class="covered" data-hits="4" data-linenumber="132">
<span class="hits">4</span>
<code class="ruby"> value.include?(param)</code>
</li>
- <li class="never" data-hits="" data-linenumber="130">
+ <li class="never" data-hits="" data-linenumber="133">
<code class="ruby"> else</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="131">
+ <li class="covered" data-hits="2" data-linenumber="134">
<span class="hits">2</span>
<code class="ruby"> Array(value).include?(param)</code>
</li>
- <li class="covered" data-hits="6" data-linenumber="132">
- <span class="hits">6</span>
+ <li class="covered" data-hits="8" data-linenumber="135">
+ <span class="hits">8</span>
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="133">
+ <li class="never" data-hits="" data-linenumber="136">
<code class="ruby"> when :min</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="134">
+ <li class="covered" data-hits="2" data-linenumber="137">
<span class="hits">2</span>
<code class="ruby"> raise InvalidParameterError, "Parameter cannot be less than #{value}" unless param.nil? || value <= param</code>
</li>
- <li class="never" data-hits="" data-linenumber="135">
+ <li class="never" data-hits="" data-linenumber="138">
<code class="ruby"> when :max</code>
</li>
- <li class="covered" data-hits="2" data-linenumber="136">
+ <li class="covered" data-hits="2" data-linenumber="139">
<span class="hits">2</span>
<code class="ruby"> raise InvalidParameterError, "Parameter cannot be greater than #{value}" unless param.nil? || value >= param</code>
</li>
- <li class="never" data-hits="" data-linenumber="137">
+ <li class="never" data-hits="" data-linenumber="140">
<code class="ruby"> when :min_length</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="138">
+ <li class="covered" data-hits="1" data-linenumber="141">
<span class="hits">1</span>
<code class="ruby"> raise InvalidParameterError, "Parameter cannot have length less than #{value}" unless param.nil? || value <= param.length</code>
</li>
- <li class="never" data-hits="" data-linenumber="139">
+ <li class="never" data-hits="" data-linenumber="142">
<code class="ruby"> when :max_length</code>
</li>
- <li class="covered" data-hits="3" data-linenumber="140">
- <span class="hits">3</span>
+ <li class="covered" data-hits="4" data-linenumber="143">
+ <span class="hits">4</span>
<code class="ruby"> raise InvalidParameterError, "Parameter cannot have length greater than #{value}" unless param.nil? || value >= param.length</code>
</li>
- <li class="never" data-hits="" data-linenumber="141">
+ <li class="never" data-hits="" data-linenumber="144">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="142">
+ <li class="never" data-hits="" data-linenumber="145">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="143">
+ <li class="never" data-hits="" data-linenumber="146">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="144">
+ <li class="never" data-hits="" data-linenumber="147">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="145">
+ <li class="covered" data-hits="1" data-linenumber="148">
<span class="hits">1</span>
<code class="ruby"> def validate_one_of!(params, names, options)</code>
</li>
- <li class="covered" data-hits="47" data-linenumber="146">
+ <li class="covered" data-hits="47" data-linenumber="149">
<span class="hits">47</span>
<code class="ruby"> raise InvalidParameterError, "Only one of [#{names.join(', ')}] is allowed" if names.count{|name| present?(params[name])} > 1</code>
</li>
- <li class="never" data-hits="" data-linenumber="147">
+ <li class="never" data-hits="" data-linenumber="150">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="148">
+ <li class="never" data-hits="" data-linenumber="151">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="149">
+ <li class="covered" data-hits="1" data-linenumber="152">
<span class="hits">1</span>
<code class="ruby"> def validate_any_of!(params, names, options)</code>
</li>
- <li class="covered" data-hits="32" data-linenumber="150">
+ <li class="covered" data-hits="32" data-linenumber="153">
<span class="hits">32</span>
<code class="ruby"> raise InvalidParameterError, "One of parameters [#{names.join(', ')}] is required" if names.count{|name| present?(params[name])} < 1</code>
</li>
- <li class="never" data-hits="" data-linenumber="151">
+ <li class="never" data-hits="" data-linenumber="154">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="152">
+ <li class="never" data-hits="" data-linenumber="155">
<code class="ruby"></code>
</li>
- <li class="never" data-hits="" data-linenumber="153">
+ <li class="never" data-hits="" data-linenumber="156">
<code class="ruby"> # ActiveSupport #present? and #blank? without patching Object</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="154">
+ <li class="covered" data-hits="1" data-linenumber="157">
<span class="hits">1</span>
<code class="ruby"> def present?(object)</code>
</li>
- <li class="covered" data-hits="58" data-linenumber="155">
+ <li class="covered" data-hits="58" data-linenumber="158">
<span class="hits">58</span>
<code class="ruby"> !blank?(object)</code>
</li>
- <li class="never" data-hits="" data-linenumber="156">
+ <li class="never" data-hits="" data-linenumber="159">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="157">
+ <li class="never" data-hits="" data-linenumber="160">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="158">
+ <li class="covered" data-hits="1" data-linenumber="161">
<span class="hits">1</span>
<code class="ruby"> def blank?(object)</code>
</li>
- <li class="covered" data-hits="58" data-linenumber="159">
+ <li class="covered" data-hits="58" data-linenumber="162">
<span class="hits">58</span>
<code class="ruby"> object.respond_to?(:empty?) ? object.empty? : !object</code>
</li>
- <li class="never" data-hits="" data-linenumber="160">
+ <li class="never" data-hits="" data-linenumber="163">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="161">
+ <li class="never" data-hits="" data-linenumber="164">
<code class="ruby"> end</code>
</li>
- <li class="never" data-hits="" data-linenumber="162">
+ <li class="never" data-hits="" data-linenumber="165">
<code class="ruby"></code>
</li>
- <li class="covered" data-hits="1" data-linenumber="163">
+ <li class="covered" data-hits="1" data-linenumber="166">
<span class="hits">1</span>
<code class="ruby"> helpers Param</code>
</li>
- <li class="never" data-hits="" data-linenumber="164">
+ <li class="never" data-hits="" data-linenumber="167">
<code class="ruby">end</code>
</li>
</ol>
</pre>
</div>
+
</div>
</div>
</body>
</html>