env_parser 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9267e9a3c9e84f53fe028aa4eaecefd43559b67
4
- data.tar.gz: efb184bc36af4c482ee88d721d5dc281b0e20ad3
3
+ metadata.gz: f97bc0fe59df6a385baed458ea66fba04b2e79ac
4
+ data.tar.gz: 76f851cd5748a48f37e6de45c5cbcd30c6830838
5
5
  SHA512:
6
- metadata.gz: 1158be532e36463128f3c97d78186d7b2d4601315e53cb9b2d2ce21fb779f617ec44cb34a375af9c95b31ee426a8ac3a8d8491cf44442b3fab42883d3e67662e
7
- data.tar.gz: b59a03c76c0988f5545e88338de325e8d1eded9b9a87a691e28768b6c94e3ef9da5bbc906787eb045dbb9fde01535086a65ae3f0988a0af405eaa3e64fbfe802
6
+ metadata.gz: 5730a3a7cc72e96ac94117b554262e59532c3c1f4486e3c1f526f5088ffe1ce5fb32289377ba54541669e428c9739cd64aafb33f1960e1d44de408832ed06e09
7
+ data.tar.gz: 8bae60dfa56d806266331d755a96d8f98c095990671d84312564ac1af5e73935d5a5bda83257255061549ca24e9c840a9ab395281d641367bff8c1d4c617947b
data/Gemfile.lock CHANGED
@@ -1,22 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- env_parser (1.1.0)
4
+ env_parser (1.2.0)
5
5
  activesupport (>= 5.0.0)
6
+ chronic
7
+ chronic_duration
6
8
 
7
9
  GEM
8
10
  remote: https://rubygems.org/
9
11
  specs:
10
- activesupport (5.1.4)
12
+ activesupport (5.2.3)
11
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (~> 0.7)
14
+ i18n (>= 0.7, < 2)
13
15
  minitest (~> 5.1)
14
16
  tzinfo (~> 1.1)
15
- concurrent-ruby (1.0.5)
17
+ chronic (0.10.2)
18
+ chronic_duration (0.10.6)
19
+ numerizer (~> 0.1.1)
20
+ concurrent-ruby (1.1.5)
16
21
  diff-lcs (1.3)
17
- i18n (0.9.1)
22
+ i18n (1.7.0)
18
23
  concurrent-ruby (~> 1.0)
19
- minitest (5.10.1)
24
+ minitest (5.12.2)
25
+ numerizer (0.1.1)
20
26
  rake (10.5.0)
21
27
  rspec (3.7.0)
22
28
  rspec-core (~> 3.7.0)
@@ -34,7 +40,7 @@ GEM
34
40
  rspec_junit_formatter (0.3.0)
35
41
  rspec-core (>= 2, < 4, != 2.12.0)
36
42
  thread_safe (0.3.6)
37
- tzinfo (1.2.4)
43
+ tzinfo (1.2.5)
38
44
  thread_safe (~> 0.1)
39
45
 
40
46
  PLATFORMS
data/README.md CHANGED
@@ -146,7 +146,7 @@ EnvParser.parse :SOME_CUSTOM_NETWORK_PORT, as: :integer, from_set: (1..65535), i
146
146
 
147
147
  ## And if the value is not allowed...
148
148
 
149
- EnvParser.parse :NEGATIVE_NUMBER, as: :integer, from_set: (1..5) ## => raises EnvParser::ValueNotAllowed
149
+ EnvParser.parse :NEGATIVE_NUMBER, as: :integer, from_set: (1..5) ## => raises EnvParser::ValueNotAllowedError
150
150
 
151
151
 
152
152
 
@@ -159,7 +159,7 @@ EnvParser.parse :MUST_BE_LOWERCASE, as: :string, validated_by: ->(value) { value
159
159
  ## ... but a block will also do the trick!
160
160
 
161
161
  EnvParser.parse(:MUST_BE_LOWERCASE, as: :string) { |value| value == value.downcase }
162
- EnvParser.parse(:CONNECTION_RETRIES, as: :integer, &:nonzero?)
162
+ EnvParser.parse(:CONNECTION_RETRIES, as: :integer, &:positive?)
163
163
  ```
164
164
 
165
165
  ---
@@ -209,6 +209,7 @@ b = EnvParser.parse :B, as: :my_special_type_of_number
209
209
 
210
210
  Additional features/options coming in the future:
211
211
 
212
+ - Allow for a ".env_parser" file where you can easily type-check and/or register (as constants) any ENV variables you like.
212
213
  - Continue to round out the "as" type selection as ideas come to mind, suggestions are made, and pull requests are submitted.
213
214
 
214
215
 
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Exception: EnvParser::Error
8
8
 
9
- &mdash; Documentation by YARD 0.9.11
9
+ &mdash; Documentation by YARD 0.9.20
10
10
 
11
11
  </title>
12
12
 
@@ -129,9 +129,9 @@
129
129
  </div>
130
130
 
131
131
  <div id="footer">
132
- Generated on Mon Dec 25 23:01:10 2017 by
132
+ Generated on Mon Oct 21 00:33:12 2019 by
133
133
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
- 0.9.11 (ruby-2.4.2).
134
+ 0.9.20 (ruby-2.4.2).
135
135
  </div>
136
136
 
137
137
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Exception: EnvParser::TypeAlreadyDefinedError
8
8
 
9
- &mdash; Documentation by YARD 0.9.11
9
+ &mdash; Documentation by YARD 0.9.20
10
10
 
11
11
  </title>
12
12
 
@@ -133,9 +133,9 @@
133
133
  </div>
134
134
 
135
135
  <div id="footer">
136
- Generated on Mon Dec 25 23:01:10 2017 by
136
+ Generated on Mon Oct 21 00:33:12 2019 by
137
137
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
138
- 0.9.11 (ruby-2.4.2).
138
+ 0.9.20 (ruby-2.4.2).
139
139
  </div>
140
140
 
141
141
  </div>
@@ -0,0 +1,178 @@
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
+ Module: EnvParser::Types::BaseTypes
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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::Types::BaseTypes";
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 (B)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Types.html" title="EnvParser::Types (module)">Types</a></span></span>
41
+ &raquo;
42
+ <span class="title">BaseTypes</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>Module: EnvParser::Types::BaseTypes
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/env_parser/types/base_types.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Defines types for primitive classes, adding the following:</p>
90
+ <table>
91
+ <tbody>
92
+ <tr>
93
+ <th><code>:as</code> value</th>
94
+ <th>type returned</th>
95
+ <th>default</th>
96
+ <th>notes</th>
97
+ </tr>
98
+ </tbody>
99
+ <tbody>
100
+ <tr>
101
+ <td>:string</td>
102
+ <td>String</td>
103
+ <td><code>''</code></td>
104
+ <td></td>
105
+ </tr>
106
+ <tr>
107
+ <td>:symbol</td>
108
+ <td>Symbol</td>
109
+ <td><code>:''</code></td>
110
+ <td></td>
111
+ </tr>
112
+ <tr>
113
+ <td>:boolean</td>
114
+ <td>TrueValue / FalseValue</td>
115
+ <td><code>false</code></td>
116
+ <td></td>
117
+ </tr>
118
+ <tr>
119
+ <td>:int / :integer</td>
120
+ <td>Integer</td>
121
+ <td><code>0</code></td>
122
+ <td></td>
123
+ </tr>
124
+ <tr>
125
+ <td>:float / :decimal / :number</td>
126
+ <td>Float</td>
127
+ <td><code>0.0</code></td>
128
+ <td></td>
129
+ </tr>
130
+ <tr>
131
+ <td>:json</td>
132
+ <td>&lt; depends on JSON given &gt;</td>
133
+ <td><code>nil</code></td>
134
+ <td></td>
135
+ </tr>
136
+ <tr>
137
+ <td>:array</td>
138
+ <td>Array</td>
139
+ <td><code>[]</code></td>
140
+ <td></td>
141
+ </tr>
142
+ <tr>
143
+ <td>:hash</td>
144
+ <td>Hash</td>
145
+ <td><code>{}</code></td>
146
+ <td></td>
147
+ </tr>
148
+ </tbody>
149
+ </table>
150
+ <p>Note JSON is parsed using <em>quirks-mode</em> (meaning &#39;true&#39;,
151
+ &#39;25&#39;, and &#39;null&#39; are all considered valid, parseable JSON).</p>
152
+
153
+
154
+ </div>
155
+ </div>
156
+ <div class="tags">
157
+
158
+
159
+ </div>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+ </div>
169
+
170
+ <div id="footer">
171
+ Generated on Mon Oct 21 00:33:12 2019 by
172
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
173
+ 0.9.20 (ruby-2.4.2).
174
+ </div>
175
+
176
+ </div>
177
+ </body>
178
+ </html>
@@ -0,0 +1,159 @@
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
+ Module: EnvParser::Types::ChronologyTypes
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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::Types::ChronologyTypes";
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 (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Types.html" title="EnvParser::Types (module)">Types</a></span></span>
41
+ &raquo;
42
+ <span class="title">ChronologyTypes</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>Module: EnvParser::Types::ChronologyTypes
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/env_parser/types/chronology_types.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Defines types for date/time-related values, adding the following:</p>
90
+ <table>
91
+ <tbody>
92
+ <tr>
93
+ <th><code>:as</code> value</th>
94
+ <th>type returned</th>
95
+ <th>default</th>
96
+ <th>notes</th>
97
+ </tr>
98
+ </tbody>
99
+ <tbody>
100
+ <tr>
101
+ <td>:date</td>
102
+ <td>Date</td>
103
+ <td><code>nil</code></td>
104
+ <td>
105
+ A natural language or ISO8601-parseable date.
106
+ <br />
107
+ Actual interpretation of the value is handled by the *chronic* gem.
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td>:time / :datetime</td>
112
+ <td>Time</td>
113
+ <td><code>nil</code></td>
114
+ <td>
115
+ A natural language or ISO8601-parseable date and time.
116
+ <br />
117
+ Actual interpretation of the value is handled by the *chronic* gem.
118
+ </td>
119
+ </tr>
120
+ <tr>
121
+ <td>:duration</td>
122
+ <td>Numeric</td>
123
+ <td><code>nil</code></td>
124
+ <td>
125
+ A natural language or ISO8601-parseable period.
126
+ <br />
127
+ Value returned is the number of seconds in the given period.
128
+ <br />
129
+ Actual interpretation of the value is handled by the *chronic_duration* gem.
130
+ </td>
131
+ </tr>
132
+ </tbody>
133
+ </table>
134
+
135
+ </div>
136
+ </div>
137
+ <div class="tags">
138
+
139
+
140
+ </div>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ </div>
150
+
151
+ <div id="footer">
152
+ Generated on Mon Oct 21 00:33:12 2019 by
153
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
+ 0.9.20 (ruby-2.4.2).
155
+ </div>
156
+
157
+ </div>
158
+ </body>
159
+ </html>
@@ -0,0 +1,159 @@
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
+ Module: EnvParser::Types::InternetTypes
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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::Types::InternetTypes";
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 (I)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Types.html" title="EnvParser::Types (module)">Types</a></span></span>
41
+ &raquo;
42
+ <span class="title">InternetTypes</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>Module: EnvParser::Types::InternetTypes
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/env_parser/types/internet_types.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+
89
+ <p>Defines types for internet-related values, adding the following:</p>
90
+ <table>
91
+ <tbody>
92
+ <tr>
93
+ <th><code>:as</code> value</th>
94
+ <th>type returned</th>
95
+ <th>default</th>
96
+ <th>notes</th>
97
+ </tr>
98
+ </tbody>
99
+ <tbody>
100
+ <tr>
101
+ <td>:ipv4_address</td>
102
+ <td>String</td>
103
+ <td><code>nil</code></td>
104
+ <td>
105
+ An IPv4 address in 4-octet dot-decimal notation,
106
+ <br />
107
+ with no CIDR or subnet suffix (e.g. <code>'192.168.0.1'</code>).
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td>:ipv6_address</td>
112
+ <td>String</td>
113
+ <td><code>nil</code></td>
114
+ <td>An IPv6 address, in RFC5952 format.</td>
115
+ </tr>
116
+ <tr>
117
+ <td>:network_port / :port</td>
118
+ <td>Integer</td>
119
+ <td><code>nil</code></td>
120
+ <td></td>
121
+ </tr>
122
+ <tr>
123
+ <td>:email_address</td>
124
+ <td>String</td>
125
+ <td><code>nil</code></td>
126
+ <td>
127
+ A "simple" email address, containing only a username and a domain.
128
+ <br />
129
+ Note this does not guarantee RFC5322-conformity.
130
+ </td>
131
+ </tr>
132
+ </tbody>
133
+ </table>
134
+
135
+ </div>
136
+ </div>
137
+ <div class="tags">
138
+
139
+
140
+ </div>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ </div>
150
+
151
+ <div id="footer">
152
+ Generated on Mon Oct 21 00:33:12 2019 by
153
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
+ 0.9.20 (ruby-2.4.2).
155
+ </div>
156
+
157
+ </div>
158
+ </body>
159
+ </html>