validators 3.0.5 → 3.1.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
  SHA256:
3
- metadata.gz: a3e94056e45b8404eae96009fa335483fb73199503fc91acb7b479ce9bb82080
4
- data.tar.gz: 3370e2642ca60032100724e39151ffdefbe59c45b67ed2edd9bdf8d2dc3306b9
3
+ metadata.gz: d59b19552e6feb2768bdebb407805ac932ae8ab96bcb6184661f388cadd5ed74
4
+ data.tar.gz: 657cd7b8292255b0c6c995dc5acb7ac2db333f70ff1ed8c5cbdf72b86aaa21a7
5
5
  SHA512:
6
- metadata.gz: 3077af8d5234423bde493d62c7e7cd309c687c6c00f2be55bfcecb4ada65006133619cdc440144f9137db9c4dd737c103ea57969b914507ef471cda1cc677b35
7
- data.tar.gz: e98b9f84cf22cb2cd606cc0888ca3b72e95ac933cfe1674ea0108c3a288462da739fa36321178d7e77d455bf10c021afc99af19ccad22943ffaaf35affef68c7
6
+ metadata.gz: 2f3eed7777518563b684699beb31c8b41e000d7b6df922f90fad6e0e9f185695fe785bfc2d1e4699a3c7f90cf4ba9b1588f2a68a4e3b8a28e70555108d5e2bc6
7
+ data.tar.gz: 8df8d756b890bfac3d2c6d1b0191cdcf80250602a0dd93caf67acfead1e2529d164f05c5b24b535b94080634096111c19cbc05ee8a5f190e3369e33e297034a1
data/README.md CHANGED
@@ -32,7 +32,8 @@ class User < ActiveRecord::Base
32
32
  end
33
33
  ```
34
34
 
35
- By default, it rejects disposable e-mails (e.g. mailinator). This loads ~15kb, but you can disable this validation by setting `disposable: true`.
35
+ By default, it rejects disposable e-mails (e.g. mailinator). This loads ~15kb,
36
+ but you can disable this validation by setting `disposable: true`.
36
37
 
37
38
  ```ruby
38
39
  class User < ActiveRecord::Base
@@ -143,9 +144,37 @@ class Server < ActiveRecord::Base
143
144
  end
144
145
  ```
145
146
 
147
+ ### validates_reserved_username / validates_reserved_hostname
148
+
149
+ The compiled list will be used for both username and hostname validations.
150
+
151
+ ```ruby
152
+ class Server < ActiveRecord::Base
153
+ validates_reserved_hostname :hostname
154
+ end
155
+
156
+ class User < ActiveRecord::Base
157
+ validates_reserved_username :username
158
+ end
159
+ ```
160
+
161
+ You can also provide your own list if you want. Any string that starts with `/`
162
+ will be parsed with `Regexp.compile`.
163
+
164
+ ```ruby
165
+ ReservedUsernames = Validators::ReservedHostnames.parse_list([
166
+ "www",
167
+ "/www[0-9-]+/"
168
+ ])
169
+
170
+ class User < ActiveRecord::Base
171
+ validates_reserved_username, in: ReservedUsernames
172
+ end
173
+ ```
174
+
146
175
  ## Maintainer
147
176
 
148
- * [Nando Vieira](http://simplesideias.com.br)
177
+ * [Nando Vieira](http://nandovieira.com)
149
178
 
150
179
  ## License
151
180