Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolab committed Feb 28, 2021
1 parent d97d76f commit d8cc2d2
Show file tree
Hide file tree
Showing 16 changed files with 434 additions and 53 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Also [validator/check](#check) (not exposed by default) provides:
dependencies:
validator:
github: nicolab/crystal-validator
version: ~> 1.2.0 # Check the latest version!
version: ~> 1.4.0 # Check the latest version!
```
2. Run `shards install`
Expand Down
48 changes: 41 additions & 7 deletions docs/Check.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.35.1">
<meta name="crystal_docs.project_version" content="master-dev">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="validator">


Expand All @@ -13,7 +13,7 @@
<script type="text/javascript" src="js/doc.js"></script>

<meta name="repository-name" content="validator">
<title>Check - validator master-dev</title>
<title>Check - validator master</title>
<script type="text/javascript">
CrystalDocs.base_path = "";
</script>
Expand All @@ -39,7 +39,7 @@ <h1 class="project-name">
</h1>

<span class="project-version">
master-dev
master
</span>
</div>
</div>
Expand Down Expand Up @@ -166,6 +166,20 @@ <h2>
Defined in:
</h2>


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

<br/>


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

<br/>




Expand Down Expand Up @@ -276,6 +290,8 @@ <h2>
<br/>
<div>

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

</div>
</div>

Expand All @@ -302,6 +318,8 @@ <h2>
<br/>
<div>

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

</div>
</div>

Expand Down Expand Up @@ -369,6 +387,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L67" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -394,17 +414,29 @@ <h2>
property content : <span class="t">String</span>
property url : <span class="t">String</span>?

<span class="k">private</span> <span class="k">def</span> <span class="m">self</span>.after_check_content(v : <span class="t">Check</span><span class="t">::</span><span class="t">Validation</span>, content : <span class="t">String</span>?, required : <span class="t">Bool</span>, format : <span class="t">Bool</span>)
puts <span class="s">&quot;after_check_content&quot;</span>
puts <span class="s">&quot;Valid? </span><span class="i">#{</span>v.valid?<span class="i">}</span><span class="s">&quot;</span>
content
<span class="k">end</span>

<span class="t">Check</span>.rules(
content: {
required: <span class="s">&quot;Content is required&quot;</span>, <span class="c"># or `true` to use the default error message</span>
check: {
required: <span class="s">&quot;Content is required&quot;</span>, <span class="c"># or `true` to use the default error message</span>
before_check: ->(v : <span class="t">Check</span><span class="t">::</span><span class="t">Validation</span>, content : <span class="t">String</span>?, required : <span class="t">Bool</span>, format : <span class="t">Bool</span>) {
puts <span class="s">&quot;before_check_content&quot;</span>
content
},
after_check: <span class="n">:after_check_email</span>,
check: {
not_empty: {<span class="s">&quot;Article content is required&quot;</span>},
between: {<span class="s">&quot;The article content must be between 10 and 20 000 characters&quot;</span>, <span class="n">10</span>, <span class="n">20_000</span>},
<span class="c"># ...</span>
},
clean: {
<span class="k">type</span>: <span class="t">String</span>,
to: <span class="n">:to_s</span>,
<span class="k">type</span>: <span class="t">String</span>,
to: <span class="n">:to_s</span>,
<span class="c"># Proc or method name (Symbol)</span>
format: ->(content : <span class="t">String</span>) { content.strip },
message: <span class="s">&quot;Wrong type&quot;</span>,
},
Expand Down Expand Up @@ -446,6 +478,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L145" target="_blank">View source</a>]

</div>
</div>

Expand Down
21 changes: 18 additions & 3 deletions docs/Check/Checkable.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.35.1">
<meta name="crystal_docs.project_version" content="master-dev">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="validator">


Expand All @@ -13,7 +13,7 @@
<script type="text/javascript" src="../js/doc.js"></script>

<meta name="repository-name" content="validator">
<title>Check::Checkable - validator master-dev</title>
<title>Check::Checkable - validator master</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
Expand All @@ -39,7 +39,7 @@ <h1 class="project-name">
</h1>

<span class="project-version">
master-dev
master
</span>
</div>
</div>
Expand Down Expand Up @@ -168,6 +168,13 @@ <h2>
Defined in:
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L463" target="_blank">
checkable.cr
</a>

<br/>




Expand Down Expand Up @@ -260,6 +267,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L486" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -284,6 +293,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L472" target="_blank">View source</a>]

</div>
</div>

Expand Down Expand Up @@ -312,6 +323,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L532" target="_blank">View source</a>]

</div>
</div>

Expand Down Expand Up @@ -340,6 +353,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L502" target="_blank">View source</a>]

</div>
</div>

Expand Down
29 changes: 26 additions & 3 deletions docs/Check/CheckableStatic.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.35.1">
<meta name="crystal_docs.project_version" content="master-dev">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="validator">


Expand All @@ -13,7 +13,7 @@
<script type="text/javascript" src="../js/doc.js"></script>

<meta name="repository-name" content="validator">
<title>Check::CheckableStatic - validator master-dev</title>
<title>Check::CheckableStatic - validator master</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
Expand All @@ -39,7 +39,7 @@ <h1 class="project-name">
</h1>

<span class="project-version">
master-dev
master
</span>
</div>
</div>
Expand Down Expand Up @@ -168,6 +168,13 @@ <h2>
Defined in:
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L301" target="_blank">
checkable.cr
</a>

<br/>




Expand Down Expand Up @@ -294,6 +301,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L381" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -319,6 +328,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L360" target="_blank">View source</a>]

</div>
</div>

Expand Down Expand Up @@ -348,6 +359,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L401" target="_blank">View source</a>]

</div>
</div>

Expand Down Expand Up @@ -377,6 +390,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L454" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -401,6 +416,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L345" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -420,6 +437,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L303" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -439,6 +458,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L318" target="_blank">View source</a>]

</div>
</div>

Expand All @@ -458,6 +479,8 @@ <h2>
<br/>
<div>

[<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L328" target="_blank">View source</a>]

</div>
</div>

Expand Down
13 changes: 10 additions & 3 deletions docs/Check/Checker.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.35.1">
<meta name="crystal_docs.project_version" content="master-dev">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="validator">


Expand All @@ -13,7 +13,7 @@
<script type="text/javascript" src="../js/doc.js"></script>

<meta name="repository-name" content="validator">
<title>Check::Checker - validator master-dev</title>
<title>Check::Checker - validator master</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
Expand All @@ -39,7 +39,7 @@ <h1 class="project-name">
</h1>

<span class="project-version">
master-dev
master
</span>
</div>
</div>
Expand Down Expand Up @@ -181,6 +181,13 @@ <h2>
Defined in:
</h2>


<a href="https://github.com/Nicolab/crystal-validator/blob/d97d76fbacd2427338e0178b4c926270338c820e/src/checkable.cr#L28" target="_blank">
checkable.cr
</a>

<br/>




Expand Down
13 changes: 10 additions & 3 deletions docs/Check/Errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.35.1">
<meta name="crystal_docs.project_version" content="master-dev">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="validator">


Expand All @@ -13,7 +13,7 @@
<script type="text/javascript" src="../js/doc.js"></script>

<meta name="repository-name" content="validator">
<title>Check::Errors - validator master-dev</title>
<title>Check::Errors - validator master</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
Expand All @@ -39,7 +39,7 @@ <h1 class="project-name">
</h1>

<span class="project-version">
master-dev
master
</span>
</div>
</div>
Expand Down Expand Up @@ -180,6 +180,13 @@ <h2>
Defined in:
</h2>


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

<br/>




Expand Down
Loading

0 comments on commit d8cc2d2

Please sign in to comment.