Skip to content

Commit

Permalink
[check] support symbol and string keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolab committed Feb 6, 2020
1 parent d805646 commit cb363e4
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 138 deletions.
14 changes: 7 additions & 7 deletions docs/Check.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2>
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L9" target="_blank">
<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L9" target="_blank">
check.cr
</a>

Expand All @@ -162,14 +162,14 @@ <h2>
<li class="entry-summary">
<a href="#new_validation(errors:Errors)-class-method" class="signature"><strong>.new_validation</strong>(errors : Errors)</a>

<div class="summary"><p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine a series of checks (<code><a href="Check/Validation.html#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p></div>
<div class="summary"><p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine a series of checks (<code><a href="Check/Validation.html#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p></div>

</li>

<li class="entry-summary">
<a href="#new_validation-class-method" class="signature"><strong>.new_validation</strong></a>

<div class="summary"><p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine a series of checks (<code><a href="Check/Validation.html#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p></div>
<div class="summary"><p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine a series of checks (<code><a href="Check/Validation.html#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p></div>

</li>

Expand Down Expand Up @@ -208,7 +208,7 @@ <h2>
<div class="doc">

<p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine
a series of checks (<code><a href="Check/Validation.html#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).
a series of checks (<code><a href="Check/Validation.html#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).
using an existing <em>errors</em> <code>Hash</code> (<code><a href="Check/Errors.html">Check::Errors</a></code>).</p>

<pre><code>v <span class="o">=</span> <span class="t">Check</span>.new_validation existing_errors</code></pre>
Expand All @@ -221,7 +221,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L322" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L322" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -237,7 +237,7 @@ <h2>
<div class="doc">

<p>Initializes a new <code><a href="Check/Validation.html">Validation</a></code> instance to combine
a series of checks (<code><a href="Check/Validation.html#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p>
a series of checks (<code><a href="Check/Validation.html#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">Validation#check</a></code>).</p>

<pre><code>v <span class="o">=</span> <span class="t">Check</span>.new_validation</code></pre>

Expand All @@ -249,7 +249,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L305" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L305" target="_blank">View source</a>]

</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/Check/Errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h2>
</a>
Alias Definition
</h2>
<code>Hash(Symbol, Array(String))</code>
<code>Hash(String | Symbol, Array(String))</code>



Expand All @@ -150,7 +150,7 @@ <h2>
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L17" target="_blank">
<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L17" target="_blank">
check.cr
</a>

Expand Down
62 changes: 31 additions & 31 deletions docs/Check/Validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h2>
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L115" target="_blank">
<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L115" target="_blank">
check.cr
</a>

Expand Down Expand Up @@ -280,35 +280,35 @@ <h2>
<ul class="list-summary">

<li class="entry-summary">
<a href="#add_error(key:Symbol,message:String):Validation-instance-method" class="signature"><strong>#add_error</strong>(key : Symbol, message : String) : Validation</a>
<a href="#add_error(key:Symbol%7CString,message:String):Validation-instance-method" class="signature"><strong>#add_error</strong>(key : Symbol | String, message : String) : Validation</a>

<div class="summary"><p>Add a validation error.</p></div>

</li>

<li class="entry-summary">
<a href="#add_error(key:Symbol):Validation-instance-method" class="signature"><strong>#add_error</strong>(key : Symbol) : Validation</a>
<a href="#add_error(key:Symbol%7CString):Validation-instance-method" class="signature"><strong>#add_error</strong>(key : Symbol | String) : Validation</a>

<div class="summary"><p>Add a validation error.</p></div>

</li>

<li class="entry-summary">
<a href="#check(key:Symbol,message:String,valid:Bool):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol, message : String, valid : Bool) : Validation</a>
<a href="#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol | String, message : String, valid : Bool) : Validation</a>

<div class="summary"><p>Checks a validation, often used in sequence.</p></div>

</li>

<li class="entry-summary">
<a href="#check(key:Symbol,valid:Bool,message:String):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol, valid : Bool, message : String) : Validation</a>
<a href="#check(key:Symbol%7CString,valid:Bool,message:String):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol | String, valid : Bool, message : String) : Validation</a>

<div class="summary"><p>Checks a validation, often used in sequence.</p></div>

</li>

<li class="entry-summary">
<a href="#check(key:Symbol,valid:Bool):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol, valid : Bool) : Validation</a>
<a href="#check(key:Symbol%7CString,valid:Bool):Validation-instance-method" class="signature"><strong>#check</strong>(key : Symbol | String, valid : Bool) : Validation</a>

<div class="summary"><p>Checks a validation, often used in sequence.</p></div>

Expand Down Expand Up @@ -390,7 +390,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L144" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L144" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -417,7 +417,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L129" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L129" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -436,12 +436,12 @@ <h2>
Instance Method Detail
</h2>

<div class="entry-detail" id="add_error(key:Symbol,message:String):Validation-instance-method">
<div class="entry-detail" id="add_error(key:Symbol|String,message:String):Validation-instance-method">
<div class="signature">

def <strong>add_error</strong>(key : Symbol, message : String) : <a href="../Check/Validation.html">Validation</a>
def <strong>add_error</strong>(key : Symbol | String, message : String) : <a href="../Check/Validation.html">Validation</a>

<a class="method-permalink" href="#add_error(key:Symbol,message:String):Validation-instance-method">#</a>
<a class="method-permalink" href="#add_error(key:Symbol%7CString,message:String):Validation-instance-method">#</a>
</div>

<div class="doc">
Expand All @@ -458,17 +458,17 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L167" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L167" target="_blank">View source</a>]

</div>
</div>

<div class="entry-detail" id="add_error(key:Symbol):Validation-instance-method">
<div class="entry-detail" id="add_error(key:Symbol|String):Validation-instance-method">
<div class="signature">

def <strong>add_error</strong>(key : Symbol) : <a href="../Check/Validation.html">Validation</a>
def <strong>add_error</strong>(key : Symbol | String) : <a href="../Check/Validation.html">Validation</a>

<a class="method-permalink" href="#add_error(key:Symbol):Validation-instance-method">#</a>
<a class="method-permalink" href="#add_error(key:Symbol%7CString):Validation-instance-method">#</a>
</div>

<div class="doc">
Expand All @@ -487,17 +487,17 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L187" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L187" target="_blank">View source</a>]

</div>
</div>

<div class="entry-detail" id="check(key:Symbol,message:String,valid:Bool):Validation-instance-method">
<div class="entry-detail" id="check(key:Symbol|String,message:String,valid:Bool):Validation-instance-method">
<div class="signature">

def <strong>check</strong>(key : Symbol, message : String, valid : Bool) : <a href="../Check/Validation.html">Validation</a>
def <strong>check</strong>(key : Symbol | String, message : String, valid : Bool) : <a href="../Check/Validation.html">Validation</a>

<a class="method-permalink" href="#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">#</a>
<a class="method-permalink" href="#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">#</a>
</div>

<div class="doc">
Expand Down Expand Up @@ -537,17 +537,17 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L229" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L229" target="_blank">View source</a>]

</div>
</div>

<div class="entry-detail" id="check(key:Symbol,valid:Bool,message:String):Validation-instance-method">
<div class="entry-detail" id="check(key:Symbol|String,valid:Bool,message:String):Validation-instance-method">
<div class="signature">

def <strong>check</strong>(key : Symbol, valid : Bool, message : String) : <a href="../Check/Validation.html">Validation</a>
def <strong>check</strong>(key : Symbol | String, valid : Bool, message : String) : <a href="../Check/Validation.html">Validation</a>

<a class="method-permalink" href="#check(key:Symbol,valid:Bool,message:String):Validation-instance-method">#</a>
<a class="method-permalink" href="#check(key:Symbol%7CString,valid:Bool,message:String):Validation-instance-method">#</a>
</div>

<div class="doc">
Expand Down Expand Up @@ -587,17 +587,17 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L266" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L266" target="_blank">View source</a>]

</div>
</div>

<div class="entry-detail" id="check(key:Symbol,valid:Bool):Validation-instance-method">
<div class="entry-detail" id="check(key:Symbol|String,valid:Bool):Validation-instance-method">
<div class="signature">

def <strong>check</strong>(key : Symbol, valid : Bool) : <a href="../Check/Validation.html">Validation</a>
def <strong>check</strong>(key : Symbol | String, valid : Bool) : <a href="../Check/Validation.html">Validation</a>

<a class="method-permalink" href="#check(key:Symbol,valid:Bool):Validation-instance-method">#</a>
<a class="method-permalink" href="#check(key:Symbol%7CString,valid:Bool):Validation-instance-method">#</a>
</div>

<div class="doc">
Expand All @@ -607,7 +607,7 @@ <h2>
<p>If <em>valid</em> is <code>false</code>, an error message is added in the <code><a href="../Check/Validation.html#errors:Errors-instance-method">#errors</a></code>.
Nothing if <em>valid</em> is <code>true</code>.</p>

<blockquote>Unlike other <code><a href="../Check/Validation.html#check(key:Symbol,message:String,valid:Bool):Validation-instance-method">#check</a></code> methods, with this one a default standard message is used.</blockquote>
<blockquote>Unlike other <code><a href="../Check/Validation.html#check(key:Symbol%7CString,message:String,valid:Bool):Validation-instance-method">#check</a></code> methods, with this one a default standard message is used.</blockquote>

<pre><code>v <span class="o">=</span> <span class="t">Check</span>.new_validation

Expand All @@ -621,7 +621,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L287" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L287" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -645,7 +645,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L154" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L154" target="_blank">View source</a>]

</div>
</div>
Expand All @@ -666,7 +666,7 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/check.cr#L193" target="_blank">View source</a>]
[<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/check.cr#L193" target="_blank">View source</a>]

</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/Valid.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h2>
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d3b904a58bb5fa5b73c1571deb4946fe81721b55/src/validator.cr#L92" target="_blank">
<a href="https://github.com/Nicolab/crystal-validator/blob/d8056465956f6f15e479af0577fd681428a27ab0/src/validator.cr#L92" target="_blank">
validator.cr
</a>

Expand All @@ -168,7 +168,7 @@ <h2>
<dl>

<dt class="entry-const" id="VERSION">
<strong>VERSION</strong> = <code><span class="s">&quot;1.0.0-rc1&quot;</span></code>
<strong>VERSION</strong> = <code><span class="s">&quot;1.0.0-rc2&quot;</span></code>
</dt>


Expand Down
Loading

0 comments on commit cb363e4

Please sign in to comment.