username 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d15b4e55705a2cd5238ad7e92a4cfee36886f9f602b21967c59ac9e5d7d3dd6
4
- data.tar.gz: ee13b30fe24e8f37deb62bef82f5b8f35430a76bfb94d95de8482962d4faad4a
3
+ metadata.gz: 30a2016ad31e9aabae42451d8f93f7f090ac25659a77bc35b4a1933ea60e4159
4
+ data.tar.gz: aafae93ad37efc1eb2ef0e7c887c47c1f37fcf29802676a772f4cff3e81b1cbf
5
5
  SHA512:
6
- metadata.gz: 771c98c923b738bbedb939f5beda10349d38e76aaecd3874c484b7fde7dae0e5862870d4cbea97060e8ca631ae483a1382d55b7c299ed8ad4f64c04b41ec9ef2
7
- data.tar.gz: e6198551b71dc0adff9d0540e15f22a0c2b6b73a29ade87f5e36005f0078b33f734a91f4feb92afae0f86798f27d93eff91439f357cf3be1d295db81ff7036e7
6
+ metadata.gz: c1ba518f119955a8eb4982f73824f667babb33b5df160ef88178104e2fb833c617b6ec74e89091fc805056cbb0bad7e3bc0ce67732c25a45c3e113910f929edc
7
+ data.tar.gz: 83c2e53ab7d4f52d66f04f84f3b854b325131466be304ba70f5accd4b831a246710d30d88288d2aaec9d9ea77e3d5fdccce7e2652ee1147d75583dc61f886b99
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 1.0.1 - 2018/01/20
8
+
9
+ * bugfixes
10
+ * fixed `forbidden` configuration option
11
+
7
12
  ### 1.0.0 - 2018/01/20
8
13
 
9
14
  * initial release
data/README.md CHANGED
@@ -65,7 +65,7 @@ Username adds a validator to prevent the use of invalid usernames.
65
65
  ### Methods
66
66
 
67
67
  ```ruby
68
- # If a username is available for an ActiveRecord class
68
+ # If a username is valid for an ActiveRecord class
69
69
  User.username_valid? 'test'
70
70
 
71
71
  # If a username is available for an ActiveRecord model
@@ -80,10 +80,11 @@ You can configure Username by passing a block to `configure`. This can be done i
80
80
 
81
81
  ```ruby
82
82
  Username.configure do |config|
83
- config.minlength = 1
83
+ config.forbidden = []
84
84
  end
85
85
  ```
86
86
 
87
+ * `forbidden` Array of forbidden usernames. Takes an array of strings. Defaults to `[]`.
87
88
  * `minlength` Minimum length for usernames. Takes an integer. Defaults to `1`.
88
89
  * `maxlength` Maximum length for usernames. Takes an integer. Defaults to `20`.
89
90
  * `regex` Strings not matching this regular expression are invalid as usernames. Takes a regular expression. Defaults to `/\A[a-zA-Z0-9_\.]*\z/`.
@@ -1,5 +1,8 @@
1
1
  Username.configure do |config|
2
2
 
3
+ # Array of forbidden usernames
4
+ # config.forbidden = []
5
+
3
6
  # Minimum length for usernames
4
7
  # config.minlength = 1
5
8
 
@@ -12,6 +12,7 @@ module Username
12
12
  class Configuration
13
13
 
14
14
  attr_accessor :models
15
+ attr_accessor :forbidden
15
16
  attr_accessor :minlength
16
17
  attr_accessor :maxlength
17
18
  attr_accessor :regex
@@ -19,6 +20,7 @@ module Username
19
20
 
20
21
  def initialize
21
22
  @models = []
23
+ @forbidden = []
22
24
  @minlength = 1
23
25
  @maxlength = 20
24
26
  @regex = /\A[a-zA-Z0-9_\.]*\z/
@@ -1,5 +1,5 @@
1
1
  module Username
2
2
 
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: username
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter