-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
8,019 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,326 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="generator" content="Crystal Docs 0.34.0"> | ||
<meta name="crystal_docs.project_version" content="master"> | ||
<meta name="crystal_docs.project_name" content="validator"> | ||
|
||
|
||
<link href="../css/style.css" rel="stylesheet" type="text/css" /> | ||
<script type="text/javascript" src="../js/doc.js"></script> | ||
|
||
<svg class="hidden"> | ||
<symbol id="octicon-link" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path> | ||
</symbol> | ||
</svg> | ||
|
||
<meta id="repository-name" content="validator"> | ||
<title>Check::Checkable - validator master</title> | ||
<script type="text/javascript"> | ||
CrystalDocs.base_path = "../"; | ||
</script> | ||
</head> | ||
<body> | ||
|
||
<div class="sidebar"> | ||
<div class="sidebar-header"> | ||
<div class="search-box"> | ||
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> | ||
</div> | ||
|
||
<div class="project-summary"> | ||
<h1 class="project-name"> | ||
<a href="../index.html"> | ||
validator | ||
</a> | ||
</h1> | ||
|
||
<span class="project-version"> | ||
master | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="search-results" class="hidden"> | ||
<ul class="search-list"></ul> | ||
</div> | ||
|
||
<div class="types-list"> | ||
<ul> | ||
|
||
<li class=" " data-id="validator/toplevel" data-name="top level namespace"> | ||
<a href="../toplevel.html">Top Level Namespace</a> | ||
|
||
</li> | ||
|
||
<li class="parent open current" data-id="validator/Check" data-name="check"> | ||
<a href="../Check.html">Check</a> | ||
|
||
<ul> | ||
|
||
<li class=" current" data-id="validator/Check/Checkable" data-name="check::checkable"> | ||
<a href="../Check/Checkable.html">Checkable</a> | ||
|
||
</li> | ||
|
||
<li class=" " data-id="validator/Check/CheckableStatic" data-name="check::checkablestatic"> | ||
<a href="../Check/CheckableStatic.html">CheckableStatic</a> | ||
|
||
</li> | ||
|
||
<li class=" " data-id="validator/Check/Checker" data-name="check::checker"> | ||
<a href="../Check/Checker.html">Checker</a> | ||
|
||
</li> | ||
|
||
<li class=" " data-id="validator/Check/Errors" data-name="check::errors"> | ||
<a href="../Check/Errors.html">Errors</a> | ||
|
||
</li> | ||
|
||
<li class=" " data-id="validator/Check/Validation" data-name="check::validation"> | ||
<a href="../Check/Validation.html">Validation</a> | ||
|
||
</li> | ||
|
||
</ul> | ||
|
||
|
||
</li> | ||
|
||
<li class=" " data-id="validator/Valid" data-name="valid"> | ||
<a href="../Valid.html">Valid</a> | ||
|
||
</li> | ||
|
||
<li class="parent " data-id="validator/Validator" data-name="validator"> | ||
<a href="../Validator.html">Validator</a> | ||
|
||
<ul> | ||
|
||
<li class=" " data-id="validator/Validator/Error" data-name="validator::error"> | ||
<a href="../Validator/Error.html">Error</a> | ||
|
||
</li> | ||
|
||
</ul> | ||
|
||
|
||
</li> | ||
|
||
</ul> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<div class="main-content"> | ||
<h1 class="type-name"> | ||
|
||
<span class="kind">module</span> Check::Checkable | ||
|
||
</h1> | ||
|
||
|
||
|
||
|
||
|
||
<h2> | ||
<a id="overview" class="anchor" href="#overview"> | ||
<svg class="octicon-link" aria-hidden="true"> | ||
<use href="#octicon-link"/> | ||
</svg> | ||
</a> | ||
Overview | ||
</h2> | ||
|
||
<p>Mixin that adds <code><a href="../Check/Checkable.html#check(format=true):Validation-instance-method">#check</a></code> method to be used with variables of an instance of the class including it. | ||
The idea is to check the instance variables of the class extending it | ||
against rules defined with <code><a href="../Check.html#rules(**fields)-macro">Check.rules</a></code> plus executing custom checkers defined with <code><a href="../Check/Checker.html">Checker</a></code>.</p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h2> | ||
<a id="defined-in" class="anchor" href="#defined-in"> | ||
<svg class="octicon-link" aria-hidden="true"> | ||
<use href="#octicon-link"/> | ||
</svg> | ||
</a> | ||
Defined in: | ||
</h2> | ||
|
||
|
||
<a href="https://github.com/Nicolab/crystal-validator/blob/e6011cb126998dd966f7b196d5891ce5c72c8810/src/checkable.cr#L294" target="_blank"> | ||
checkable.cr | ||
</a> | ||
|
||
<br/> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h2> | ||
<a id="instance-method-summary" class="anchor" href="#instance-method-summary"> | ||
<svg class="octicon-link" aria-hidden="true"> | ||
<use href="#octicon-link"/> | ||
</svg> | ||
</a> | ||
Instance Method Summary | ||
</h2> | ||
<ul class="list-summary"> | ||
|
||
<li class="entry-summary"> | ||
<a href="#after_check(v:Check::Validation,format:Bool=true)-instance-method" class="signature"><strong>#after_check</strong>(v : Check::Validation, format : Bool = <span class="n">true</span>)</a> | ||
|
||
<div class="summary"><p>Lifecycle method triggered after each call of <code><a href="../Check/Checkable.html#check(format=true):Validation-instance-method">#check</a></code>.</p></div> | ||
|
||
</li> | ||
|
||
<li class="entry-summary"> | ||
<a href="#before_check(v:Check::Validation,format:Bool=true)-instance-method" class="signature"><strong>#before_check</strong>(v : Check::Validation, format : Bool = <span class="n">true</span>)</a> | ||
|
||
<div class="summary"><p>Lifecycle method triggered before each call of <code><a href="../Check/Checkable.html#check(format=true):Validation-instance-method">#check</a></code>.</p></div> | ||
|
||
</li> | ||
|
||
<li class="entry-summary"> | ||
<a href="#check(format=true):Validation-instance-method" class="signature"><strong>#check</strong>(format = <span class="n">true</span>) : Validation</a> | ||
|
||
<div class="summary"><p>Checks the instance fields and clean them.</p></div> | ||
|
||
</li> | ||
|
||
</ul> | ||
|
||
|
||
|
||
|
||
|
||
<div class="methods-inherited"> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<h2> | ||
<a id="instance-method-detail" class="anchor" href="#instance-method-detail"> | ||
<svg class="octicon-link" aria-hidden="true"> | ||
<use href="#octicon-link"/> | ||
</svg> | ||
</a> | ||
Instance Method Detail | ||
</h2> | ||
|
||
<div class="entry-detail" id="after_check(v:Check::Validation,format:Bool=true)-instance-method"> | ||
<div class="signature"> | ||
|
||
def <strong>after_check</strong>(v : <a href="../Check/Validation.html">Check::Validation</a>, format : Bool = <span class="n">true</span>) | ||
|
||
<a class="method-permalink" href="#after_check(v:Check::Validation,format:Bool=true)-instance-method">#</a> | ||
</div> | ||
|
||
<div class="doc"> | ||
|
||
<p>Lifecycle method triggered after each call of <code><a href="../Check/Checkable.html#check(format=true):Validation-instance-method">#check</a></code>.</p> | ||
|
||
<pre><code><span class="c"># Triggered on instance: `user.check`</span> | ||
<span class="k">def</span> <span class="m">after_check</span>(v : <span class="t">Check</span><span class="t">::</span><span class="t">Validation</span>, format : <span class="t">Bool</span>) | ||
<span class="c"># Code...</span> | ||
<span class="k">end</span></code></pre> | ||
</div> | ||
|
||
<br/> | ||
<div> | ||
|
||
[<a href="https://github.com/Nicolab/crystal-validator/blob/e6011cb126998dd966f7b196d5891ce5c72c8810/src/checkable.cr#L313" target="_blank">View source</a>] | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="entry-detail" id="before_check(v:Check::Validation,format:Bool=true)-instance-method"> | ||
<div class="signature"> | ||
|
||
def <strong>before_check</strong>(v : <a href="../Check/Validation.html">Check::Validation</a>, format : Bool = <span class="n">true</span>) | ||
|
||
<a class="method-permalink" href="#before_check(v:Check::Validation,format:Bool=true)-instance-method">#</a> | ||
</div> | ||
|
||
<div class="doc"> | ||
|
||
<p>Lifecycle method triggered before each call of <code><a href="../Check/Checkable.html#check(format=true):Validation-instance-method">#check</a></code>.</p> | ||
|
||
<pre><code><span class="c"># Triggered on instance: `user.check`</span> | ||
<span class="k">def</span> <span class="m">before_check</span>(v : <span class="t">Check</span><span class="t">::</span><span class="t">Validation</span>, format : <span class="t">Bool</span>) | ||
<span class="c"># Code...</span> | ||
<span class="k">end</span></code></pre> | ||
</div> | ||
|
||
<br/> | ||
<div> | ||
|
||
[<a href="https://github.com/Nicolab/crystal-validator/blob/e6011cb126998dd966f7b196d5891ce5c72c8810/src/checkable.cr#L303" target="_blank">View source</a>] | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="entry-detail" id="check(format=true):Validation-instance-method"> | ||
<div class="signature"> | ||
|
||
def <strong>check</strong>(format = <span class="n">true</span>) : <a href="../Check/Validation.html">Validation</a> | ||
|
||
<a class="method-permalink" href="#check(format=true):Validation-instance-method">#</a> | ||
</div> | ||
|
||
<div class="doc"> | ||
|
||
<p>Checks the instance fields and clean them.</p> | ||
|
||
<p>It instantiates a <code><a href="../Check/Validation.html">Check::Validation</a></code> and calls all methods | ||
related to rules and then methods defined with annotation <code><a href="../Check/Checker.html">Checker</a></code>.</p> | ||
|
||
<p>Lifecycle methods <code><a href="../Check/Checkable.html#before_check(v:Check::Validation,format:Bool=true)-instance-method">#before_check</a></code> and <code><a href="../Check/Checkable.html#after_check(v:Check::Validation,format:Bool=true)-instance-method">#after_check</a></code> that are triggered | ||
respectively at the beginning and at the end of the process.</p> | ||
|
||
<p><em>format</em> is used to tell cleaners generated by <code><a href="../Check.html#rules(**fields)-macro">Check.rules</a></code> | ||
to execute format method if it has been defined.</p> | ||
</div> | ||
|
||
<br/> | ||
<div> | ||
|
||
[<a href="https://github.com/Nicolab/crystal-validator/blob/e6011cb126998dd966f7b196d5891ce5c72c8810/src/checkable.cr#L325" target="_blank">View source</a>] | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.