env_parser 0.7.0 → 0.8.0

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.
@@ -0,0 +1,139 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Exception: EnvParser::Error
8
+
9
+ &mdash; Documentation by YARD 0.9.11
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "EnvParser::Error";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (E)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span>
41
+ &raquo;
42
+ <span class="title">Error</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Exception: EnvParser::Error
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">StandardError</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">StandardError</li>
78
+
79
+ <li class="next">EnvParser::Error</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/env_parser.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Base exception class for EnvParser.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div><div id="subclasses">
116
+ <h2>Direct Known Subclasses</h2>
117
+ <p class="children"><span class='object_link'><a href="TypeAlreadyDefined.html" title="EnvParser::TypeAlreadyDefined (class)">TypeAlreadyDefined</a></span>, <span class='object_link'><a href="ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span></p>
118
+ </div>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ </div>
130
+
131
+ <div id="footer">
132
+ Generated on Sun Dec 24 19:33:35 2017 by
133
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
+ 0.9.11 (ruby-2.4.2).
135
+ </div>
136
+
137
+ </div>
138
+ </body>
139
+ </html>
@@ -0,0 +1,143 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Exception: EnvParser::TypeAlreadyDefined
8
+
9
+ &mdash; Documentation by YARD 0.9.11
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "EnvParser::TypeAlreadyDefined";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (T)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span>
41
+ &raquo;
42
+ <span class="title">TypeAlreadyDefined</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Exception: EnvParser::TypeAlreadyDefined
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Error.html" title="EnvParser::Error (class)">Error</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">StandardError</li>
78
+
79
+ <li class="next"><span class='object_link'><a href="Error.html" title="EnvParser::Error (class)">Error</a></span></li>
80
+
81
+ <li class="next">EnvParser::TypeAlreadyDefined</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+ </dl>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <dl>
100
+ <dt>Defined in:</dt>
101
+ <dd>lib/env_parser.rb</dd>
102
+ </dl>
103
+
104
+ </div>
105
+
106
+ <h2>Overview</h2><div class="docstring">
107
+ <div class="discussion">
108
+
109
+ <p>Exception class used to indicate a type has already been defined.</p>
110
+
111
+
112
+ </div>
113
+ </div>
114
+ <div class="tags">
115
+
116
+
117
+ </div>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ </div>
134
+
135
+ <div id="footer">
136
+ Generated on Sun Dec 24 19:33:35 2017 by
137
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
138
+ 0.9.11 (ruby-2.4.2).
139
+ </div>
140
+
141
+ </div>
142
+ </body>
143
+ </html>
@@ -69,13 +69,15 @@
69
69
  <dl>
70
70
  <dt>Inherits:</dt>
71
71
  <dd>
72
- <span class="inheritName">StandardError</span>
72
+ <span class="inheritName"><span class='object_link'><a href="Error.html" title="EnvParser::Error (class)">Error</a></span></span>
73
73
 
74
74
  <ul class="fullTree">
75
75
  <li>Object</li>
76
76
 
77
77
  <li class="next">StandardError</li>
78
78
 
79
+ <li class="next"><span class='object_link'><a href="Error.html" title="EnvParser::Error (class)">Error</a></span></li>
80
+
79
81
  <li class="next">EnvParser::ValueNotAllowed</li>
80
82
 
81
83
  </ul>
@@ -122,11 +124,17 @@ option.</p>
122
124
 
123
125
 
124
126
 
127
+
128
+
129
+
130
+
131
+
132
+
125
133
 
126
134
  </div>
127
135
 
128
136
  <div id="footer">
129
- Generated on Mon Dec 11 23:37:25 2017 by
137
+ Generated on Sun Dec 24 19:33:35 2017 by
130
138
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
131
139
  0.9.11 (ruby-2.4.2).
132
140
  </div>
@@ -69,6 +69,8 @@
69
69
  <h2>Namespace Listing A-Z</h2>
70
70
 
71
71
 
72
+ <ul class="toplevel"><li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li></ul>
73
+
72
74
 
73
75
 
74
76
  <table>
@@ -85,6 +87,28 @@
85
87
 
86
88
  </li>
87
89
 
90
+ <li>
91
+ <span class='object_link'><a href="EnvParser/Error.html" title="EnvParser::Error (class)">Error</a></span>
92
+
93
+ <small>(EnvParser)</small>
94
+
95
+ </li>
96
+
97
+ </ul>
98
+ </ul>
99
+
100
+
101
+ <ul id="alpha_T" class="alpha">
102
+ <li class="letter">T</li>
103
+ <ul>
104
+
105
+ <li>
106
+ <span class='object_link'><a href="EnvParser/TypeAlreadyDefined.html" title="EnvParser::TypeAlreadyDefined (class)">TypeAlreadyDefined</a></span>
107
+
108
+ <small>(EnvParser)</small>
109
+
110
+ </li>
111
+
88
112
  </ul>
89
113
  </ul>
90
114
 
@@ -112,7 +136,7 @@
112
136
  </div>
113
137
 
114
138
  <div id="footer">
115
- Generated on Mon Dec 11 23:37:25 2017 by
139
+ Generated on Sun Dec 24 19:33:34 2017 by
116
140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
117
141
  0.9.11 (ruby-2.4.2).
118
142
  </div>
@@ -43,7 +43,7 @@
43
43
 
44
44
  <ul id="full_list" class="class">
45
45
  <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
46
- <li id='object_EnvParser' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span> &lt; Object<small class='search_info'>Top Level Namespace</small></div><ul><li id='object_EnvParser::ValueNotAllowed' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span> &lt; StandardError<small class='search_info'>EnvParser</small></div></li></ul></li>
46
+ <li id='object_EnvParser' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span> &lt; Object<small class='search_info'>Top Level Namespace</small></div><ul><li id='object_EnvParser::Error' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="EnvParser/Error.html" title="EnvParser::Error (class)">Error</a></span> &lt; StandardError<small class='search_info'>EnvParser</small></div></li><li id='object_EnvParser::TypeAlreadyDefined' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="EnvParser/TypeAlreadyDefined.html" title="EnvParser::TypeAlreadyDefined (class)">TypeAlreadyDefined</a></span> &lt; Error<small class='search_info'>EnvParser</small></div></li><li id='object_EnvParser::ValueNotAllowed' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span> &lt; Error<small class='search_info'>EnvParser</small></div></li></ul></li>
47
47
 
48
48
  </ul>
49
49
  </div>
@@ -108,7 +108,8 @@ makes <em>the values themselves</em> usable with a minimum of effort.</p>
108
108
  </code></pre>
109
109
  <hr>
110
110
 
111
- <p>The named <code>:as</code> parameter is required. Allowed values are:</p>
111
+ <p>The named <code>:as</code> parameter is required. The list of allowed
112
+ values is user-expandable, but allowed values out-of-the-box are:</p>
112
113
  <table>
113
114
  <tbody>
114
115
  <tr>
@@ -236,6 +237,34 @@ makes <em>the values themselves</em> usable with a minimum of effort.</p>
236
237
  </span><span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='symbol'>:SHORT_PI</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:float</span> <span class='comment'>## =&gt; 3.1415926
237
238
  </span><span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</span> <span class='symbol'>:SHORT_PI</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:float</span> <span class='comment'>## Your constant is set, my man!
238
239
  </span></code></pre>
240
+
241
+ <h4 id="label-Defining+your+own+types+for+use+with+EnvParser">Defining your own types for use with EnvParser</h4>
242
+
243
+ <pre class="code ruby"><code class="ruby"><span class='comment'>## If you use a particular validation many times, or are often manipulating values in the same way
244
+ </span><span class='comment'>## after EnvParser has done its thing, you may want to register a new type altogether.
245
+ </span><span class='comment'>##
246
+ </span><span class='id identifier rubyid_a'>a</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:A</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:int</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span>
247
+ <span class='id identifier rubyid_raise'>raise</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
248
+
249
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:B</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:int</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span>
250
+ <span class='id identifier rubyid_raise'>raise</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span><span class='rparen'>)</span>
251
+
252
+ <span class='comment'>## ... is perhaps best handled by defining a new type:
253
+ </span><span class='comment'>##
254
+ </span><span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_define_type'><span class='object_link'><a href="EnvParser.html#define_type-class_method" title="EnvParser.define_type (method)">define_type</a></span></span><span class='lparen'>(</span><span class='symbol'>:my_special_type_of_number</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
255
+ <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
256
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>StandardError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>this is not a &quot;special type&quot; number</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
257
+
258
+ <span class='id identifier rubyid_value'>value</span>
259
+ <span class='kw'>end</span>
260
+
261
+ <span class='id identifier rubyid_a'>a</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:A</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:my_special_type_of_number</span>
262
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:B</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:my_special_type_of_number</span>
263
+
264
+ <span class='comment'>## Defining a new type makes your code both more maintainable (all the logic for your special type
265
+ </span><span class='comment'>## is only defined once) and more readable (your &quot;parse&quot; calls aren&#39;t littered with type-checking
266
+ </span><span class='comment'>## cruft).
267
+ </span></code></pre>
239
268
  <hr>
240
269
 
241
270
  <p><a href="http://nestor-custodio.github.io/env_parser">Consult the repo
@@ -245,8 +274,8 @@ docs</a> for the full EnvParser documentation.</p>
245
274
 
246
275
  <p>Additional features/options coming in the future:</p>
247
276
  <ul><li>
248
- <p>A means to register validation blocks as new “as” types. This will allow
249
- for custom “as” types like <code>:url</code>, <code>:email</code>, etc.</p>
277
+ <p>Round out the “as” type selection with things like <code>:url</code>,
278
+ <code>:email</code>, etc.</p>
250
279
  </li><li>
251
280
  <p>… ?</p>
252
281
  </li></ul>
@@ -280,7 +309,7 @@ href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
280
309
  </div></div>
281
310
 
282
311
  <div id="footer">
283
- Generated on Mon Dec 11 23:37:25 2017 by
312
+ Generated on Sun Dec 24 19:33:35 2017 by
284
313
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
285
314
  0.9.11 (ruby-2.4.2).
286
315
  </div>
@@ -108,7 +108,8 @@ makes <em>the values themselves</em> usable with a minimum of effort.</p>
108
108
  </code></pre>
109
109
  <hr>
110
110
 
111
- <p>The named <code>:as</code> parameter is required. Allowed values are:</p>
111
+ <p>The named <code>:as</code> parameter is required. The list of allowed
112
+ values is user-expandable, but allowed values out-of-the-box are:</p>
112
113
  <table>
113
114
  <tbody>
114
115
  <tr>
@@ -236,6 +237,34 @@ makes <em>the values themselves</em> usable with a minimum of effort.</p>
236
237
  </span><span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span> <span class='symbol'>:SHORT_PI</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:float</span> <span class='comment'>## =&gt; 3.1415926
237
238
  </span><span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</span> <span class='symbol'>:SHORT_PI</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:float</span> <span class='comment'>## Your constant is set, my man!
238
239
  </span></code></pre>
240
+
241
+ <h4 id="label-Defining+your+own+types+for+use+with+EnvParser">Defining your own types for use with EnvParser</h4>
242
+
243
+ <pre class="code ruby"><code class="ruby"><span class='comment'>## If you use a particular validation many times, or are often manipulating values in the same way
244
+ </span><span class='comment'>## after EnvParser has done its thing, you may want to register a new type altogether.
245
+ </span><span class='comment'>##
246
+ </span><span class='id identifier rubyid_a'>a</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:A</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:int</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span>
247
+ <span class='id identifier rubyid_raise'>raise</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
248
+
249
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:B</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:int</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span>
250
+ <span class='id identifier rubyid_raise'>raise</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span><span class='rparen'>)</span>
251
+
252
+ <span class='comment'>## ... is perhaps best handled by defining a new type:
253
+ </span><span class='comment'>##
254
+ </span><span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_define_type'><span class='object_link'><a href="EnvParser.html#define_type-class_method" title="EnvParser.define_type (method)">define_type</a></span></span><span class='lparen'>(</span><span class='symbol'>:my_special_type_of_number</span><span class='comma'>,</span> <span class='label'>if_unset:</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
255
+ <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
256
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>StandardError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>this is not a &quot;special type&quot; number</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_passes_all_my_checks?'>passes_all_my_checks?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
257
+
258
+ <span class='id identifier rubyid_value'>value</span>
259
+ <span class='kw'>end</span>
260
+
261
+ <span class='id identifier rubyid_a'>a</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:A</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:my_special_type_of_number</span>
262
+ <span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="EnvParser.html#parse-class_method" title="EnvParser.parse (method)">parse</a></span></span> <span class='symbol'>:B</span><span class='comma'>,</span> <span class='label'>as:</span> <span class='symbol'>:my_special_type_of_number</span>
263
+
264
+ <span class='comment'>## Defining a new type makes your code both more maintainable (all the logic for your special type
265
+ </span><span class='comment'>## is only defined once) and more readable (your &quot;parse&quot; calls aren&#39;t littered with type-checking
266
+ </span><span class='comment'>## cruft).
267
+ </span></code></pre>
239
268
  <hr>
240
269
 
241
270
  <p><a href="http://nestor-custodio.github.io/env_parser">Consult the repo
@@ -245,8 +274,8 @@ docs</a> for the full EnvParser documentation.</p>
245
274
 
246
275
  <p>Additional features/options coming in the future:</p>
247
276
  <ul><li>
248
- <p>A means to register validation blocks as new “as” types. This will allow
249
- for custom “as” types like <code>:url</code>, <code>:email</code>, etc.</p>
277
+ <p>Round out the “as” type selection with things like <code>:url</code>,
278
+ <code>:email</code>, etc.</p>
250
279
  </li><li>
251
280
  <p>… ?</p>
252
281
  </li></ul>
@@ -280,7 +309,7 @@ href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
280
309
  </div></div>
281
310
 
282
311
  <div id="footer">
283
- Generated on Mon Dec 11 23:37:25 2017 by
312
+ Generated on Sun Dec 24 19:33:34 2017 by
284
313
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
285
314
  0.9.11 (ruby-2.4.2).
286
315
  </div>