lite-validators 1.0.5 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +86 -78
- data/config/locales/en.yml +4 -0
- data/docs/ALPHA.md +3 -3
- data/docs/ALPHA_NUMERIC.md +3 -3
- data/docs/BASE64.md +1 -1
- data/docs/BOOLEAN.md +8 -1
- data/docs/COMPARE.md +1 -1
- data/docs/COORDINATE.md +2 -2
- data/docs/CREDIT_CARD.md +2 -2
- data/docs/CSV.md +3 -3
- data/docs/CURRENCY.md +1 -1
- data/docs/CUSIP.md +1 -1
- data/docs/EMAIL.md +3 -3
- data/docs/FILE_CONTENT_TYPE.md +3 -3
- data/docs/FILE_EXTENSION.md +2 -2
- data/docs/FILE_SIZE.md +3 -3
- data/docs/HEX.md +1 -1
- data/docs/IMEI.md +1 -1
- data/docs/IP_ADDRESS.md +2 -2
- data/docs/ISBN.md +1 -1
- data/docs/ISIN.md +1 -1
- data/docs/MAC_ADDRESS.md +1 -1
- data/docs/NAME.md +1 -1
- data/docs/PASSWORD.md +2 -2
- data/docs/PHONE_NUMBER.md +1 -1
- data/docs/SEDOL.md +1 -1
- data/docs/SLUG.md +1 -1
- data/docs/SSN.md +1 -1
- data/docs/TIME_ZONE.md +1 -1
- data/docs/TYPE.md +5 -5
- data/docs/URL.md +4 -4
- data/docs/USERNAME.md +2 -2
- data/docs/UUID.md +2 -2
- data/lib/lite/validators/alpha_validator.rb +1 -1
- data/lib/lite/validators/base64_validator.rb +1 -3
- data/lib/lite/validators/base_validator.rb +3 -3
- data/lib/lite/validators/boolean_validator.rb +24 -4
- data/lib/lite/validators/compare_validator.rb +1 -1
- data/lib/lite/validators/coordinate_validator.rb +1 -1
- data/lib/lite/validators/credit_card_validator.rb +2 -2
- data/lib/lite/validators/csv_validator.rb +4 -4
- data/lib/lite/validators/currency_validator.rb +1 -1
- data/lib/lite/validators/cusip_validator.rb +1 -1
- data/lib/lite/validators/ein_validator.rb +1 -1
- data/lib/lite/validators/email_validator.rb +2 -2
- data/lib/lite/validators/file_content_type_validator.rb +1 -1
- data/lib/lite/validators/file_extension_validator.rb +1 -3
- data/lib/lite/validators/file_size_validator.rb +4 -4
- data/lib/lite/validators/hex_validator.rb +1 -1
- data/lib/lite/validators/imei_validator.rb +1 -1
- data/lib/lite/validators/ip_address_validator.rb +1 -1
- data/lib/lite/validators/isbn_validator.rb +1 -1
- data/lib/lite/validators/isin_validator.rb +6 -6
- data/lib/lite/validators/mac_address_validator.rb +5 -5
- data/lib/lite/validators/name_validator.rb +1 -1
- data/lib/lite/validators/password_validator.rb +1 -1
- data/lib/lite/validators/phone_number_validator.rb +1 -1
- data/lib/lite/validators/railtie.rb +1 -1
- data/lib/lite/validators/sedol_validator.rb +2 -2
- data/lib/lite/validators/slug_validator.rb +1 -1
- data/lib/lite/validators/ssn_validator.rb +1 -1
- data/lib/lite/validators/type_validator.rb +1 -1
- data/lib/lite/validators/url_validator.rb +5 -5
- data/lib/lite/validators/username_validator.rb +1 -1
- data/lib/lite/validators/uuid_validator.rb +1 -1
- data/lib/lite/validators/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c80e1764c537172b0a2fb0dd79a1e11440af9f0b7ba0d02c9a02aaac986e52c
|
4
|
+
data.tar.gz: e1af8a2b53184eb5dc6f3ba18e053d199077c4ccdcb90b06eb3018fc3a05f0bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1be9d44a2182f48ebf5ec848dbf741e5d947b1baa5bc07d0ad0d0c0197a8f9d1f1b8ac15c221bf1cfaa05d70332387a60261f0a4d1f731efd026cc399b80757e
|
7
|
+
data.tar.gz: fa6954479d3eb3d90aa44a05a95f194d71cf4f87d92b34de2924e946520312965d1681ee9fb4984bb2bf945031f83dc0348777c2fe3e9e13092788d52efd5686
|
data/.rubocop.yml
CHANGED
@@ -2,11 +2,14 @@ require:
|
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
6
7
|
DisplayCopNames: true
|
7
8
|
DisplayStyleGuide: true
|
8
|
-
|
9
|
-
|
9
|
+
Gemspec/RequiredRubyVersion:
|
10
|
+
Enabled: false
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
12
|
+
Enabled: true
|
10
13
|
Layout/EmptyLinesAroundBlockBody:
|
11
14
|
Exclude:
|
12
15
|
- 'spec/**/**/*'
|
@@ -14,6 +17,18 @@ Layout/EmptyLinesAroundClassBody:
|
|
14
17
|
EnforcedStyle: empty_lines_except_namespace
|
15
18
|
Layout/EmptyLinesAroundModuleBody:
|
16
19
|
EnforcedStyle: empty_lines_except_namespace
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 100
|
22
|
+
Layout/SpaceAroundMethodCallOperator:
|
23
|
+
Enabled: true
|
24
|
+
Lint/ConstantDefinitionInBlock:
|
25
|
+
Enabled: false
|
26
|
+
Lint/EmptyClass:
|
27
|
+
Enabled: false
|
28
|
+
Lint/RaiseException:
|
29
|
+
Enabled: true
|
30
|
+
Lint/StructNewOverride:
|
31
|
+
Enabled: true
|
17
32
|
Metrics/BlockLength:
|
18
33
|
Exclude:
|
19
34
|
- 'spec/**/**/*'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.1.2] - 2021-07-05
|
10
|
+
### Updated
|
11
|
+
- Improve array build performance
|
12
|
+
|
13
|
+
## [1.1.1] - 2020-06-06
|
14
|
+
### Updated
|
15
|
+
- Improve mac address regex
|
16
|
+
|
17
|
+
## [1.1.0] - 2020-09-04
|
18
|
+
### Updated
|
19
|
+
- Updated username regex
|
20
|
+
|
21
|
+
## [1.0.7] - 2020-07-03
|
22
|
+
### Added
|
23
|
+
- Added Ruby 2.7 support
|
24
|
+
|
25
|
+
## [1.0.6] - 2019-09-18
|
26
|
+
### Added
|
27
|
+
- Added true and false only checks to boolean validator
|
28
|
+
|
9
29
|
## [1.0.5] - 2019-08-09
|
10
30
|
### Added
|
11
31
|
- Added length check to Url validator
|
data/Gemfile.lock
CHANGED
@@ -1,115 +1,123 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-validators (1.
|
4
|
+
lite-validators (1.1.2)
|
5
5
|
activemodel
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (6.
|
11
|
-
actionview (= 6.
|
12
|
-
activesupport (= 6.
|
13
|
-
rack (~> 2.0)
|
10
|
+
actionpack (6.1.3.2)
|
11
|
+
actionview (= 6.1.3.2)
|
12
|
+
activesupport (= 6.1.3.2)
|
13
|
+
rack (~> 2.0, >= 2.0.9)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
actionview (6.
|
18
|
-
activesupport (= 6.
|
17
|
+
actionview (6.1.3.2)
|
18
|
+
activesupport (= 6.1.3.2)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
activemodel (6.
|
24
|
-
activesupport (= 6.
|
25
|
-
activesupport (6.
|
23
|
+
activemodel (6.1.3.2)
|
24
|
+
activesupport (= 6.1.3.2)
|
25
|
+
activesupport (6.1.3.2)
|
26
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
|
-
i18n (>=
|
28
|
-
minitest (
|
29
|
-
tzinfo (~>
|
30
|
-
zeitwerk (~> 2.
|
31
|
-
ast (2.4.
|
32
|
-
builder (3.2.
|
27
|
+
i18n (>= 1.6, < 2)
|
28
|
+
minitest (>= 5.1)
|
29
|
+
tzinfo (~> 2.0)
|
30
|
+
zeitwerk (~> 2.3)
|
31
|
+
ast (2.4.2)
|
32
|
+
builder (3.2.4)
|
33
33
|
colorize (0.8.1)
|
34
|
-
concurrent-ruby (1.1.
|
35
|
-
crass (1.0.
|
36
|
-
diff-lcs (1.
|
37
|
-
erubi (1.
|
38
|
-
fasterer (0.
|
34
|
+
concurrent-ruby (1.1.8)
|
35
|
+
crass (1.0.6)
|
36
|
+
diff-lcs (1.4.4)
|
37
|
+
erubi (1.10.0)
|
38
|
+
fasterer (0.9.0)
|
39
39
|
colorize (~> 0.7)
|
40
|
-
ruby_parser (>= 3.
|
41
|
-
i18n (1.
|
40
|
+
ruby_parser (>= 3.14.1)
|
41
|
+
i18n (1.8.10)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
|
-
|
44
|
-
loofah (2.2.3)
|
43
|
+
loofah (2.9.1)
|
45
44
|
crass (~> 1.0.2)
|
46
45
|
nokogiri (>= 1.5.9)
|
47
|
-
method_source (0.
|
48
|
-
mini_portile2 (2.
|
49
|
-
minitest (5.
|
50
|
-
nokogiri (1.
|
51
|
-
mini_portile2 (~> 2.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
method_source (1.0.0)
|
47
|
+
mini_portile2 (2.5.1)
|
48
|
+
minitest (5.14.4)
|
49
|
+
nokogiri (1.11.3)
|
50
|
+
mini_portile2 (~> 2.5.0)
|
51
|
+
racc (~> 1.4)
|
52
|
+
parallel (1.20.1)
|
53
|
+
parser (3.0.1.1)
|
54
|
+
ast (~> 2.4.1)
|
55
|
+
racc (1.5.2)
|
56
|
+
rack (2.2.3)
|
56
57
|
rack-test (1.1.0)
|
57
58
|
rack (>= 1.0, < 3)
|
58
59
|
rails-dom-testing (2.0.3)
|
59
60
|
activesupport (>= 4.2.0)
|
60
61
|
nokogiri (>= 1.6)
|
61
|
-
rails-html-sanitizer (1.
|
62
|
-
loofah (~> 2.
|
63
|
-
railties (6.
|
64
|
-
actionpack (= 6.
|
65
|
-
activesupport (= 6.
|
62
|
+
rails-html-sanitizer (1.3.0)
|
63
|
+
loofah (~> 2.3)
|
64
|
+
railties (6.1.3.2)
|
65
|
+
actionpack (= 6.1.3.2)
|
66
|
+
activesupport (= 6.1.3.2)
|
66
67
|
method_source
|
67
68
|
rake (>= 0.8.7)
|
68
|
-
thor (
|
69
|
+
thor (~> 1.0)
|
69
70
|
rainbow (3.0.0)
|
70
|
-
rake (
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
rspec-
|
75
|
-
|
76
|
-
rspec-
|
77
|
-
rspec-
|
71
|
+
rake (13.0.3)
|
72
|
+
regexp_parser (2.1.1)
|
73
|
+
rexml (3.2.5)
|
74
|
+
rspec (3.10.0)
|
75
|
+
rspec-core (~> 3.10.0)
|
76
|
+
rspec-expectations (~> 3.10.0)
|
77
|
+
rspec-mocks (~> 3.10.0)
|
78
|
+
rspec-core (3.10.1)
|
79
|
+
rspec-support (~> 3.10.0)
|
80
|
+
rspec-expectations (3.10.1)
|
78
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
-
rspec-support (~> 3.
|
80
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.10.0)
|
83
|
+
rspec-mocks (3.10.2)
|
81
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-rails (
|
84
|
-
actionpack (>=
|
85
|
-
activesupport (>=
|
86
|
-
railties (>=
|
87
|
-
rspec-core (~> 3.
|
88
|
-
rspec-expectations (~> 3.
|
89
|
-
rspec-mocks (~> 3.
|
90
|
-
rspec-support (~> 3.
|
91
|
-
rspec-support (3.
|
92
|
-
rubocop (
|
93
|
-
jaro_winkler (~> 1.5.1)
|
85
|
+
rspec-support (~> 3.10.0)
|
86
|
+
rspec-rails (5.0.1)
|
87
|
+
actionpack (>= 5.2)
|
88
|
+
activesupport (>= 5.2)
|
89
|
+
railties (>= 5.2)
|
90
|
+
rspec-core (~> 3.10)
|
91
|
+
rspec-expectations (~> 3.10)
|
92
|
+
rspec-mocks (~> 3.10)
|
93
|
+
rspec-support (~> 3.10)
|
94
|
+
rspec-support (3.10.2)
|
95
|
+
rubocop (1.14.0)
|
94
96
|
parallel (~> 1.10)
|
95
|
-
parser (>=
|
97
|
+
parser (>= 3.0.0.0)
|
96
98
|
rainbow (>= 2.2.2, < 4.0)
|
99
|
+
regexp_parser (>= 1.8, < 3.0)
|
100
|
+
rexml
|
101
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
97
102
|
ruby-progressbar (~> 1.7)
|
98
|
-
unicode-display_width (>= 1.4.0, <
|
99
|
-
rubocop-
|
100
|
-
|
101
|
-
rubocop-
|
102
|
-
rubocop (>=
|
103
|
-
|
104
|
-
|
103
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
104
|
+
rubocop-ast (1.5.0)
|
105
|
+
parser (>= 3.0.1.1)
|
106
|
+
rubocop-performance (1.11.3)
|
107
|
+
rubocop (>= 1.7.0, < 2.0)
|
108
|
+
rubocop-ast (>= 0.4.0)
|
109
|
+
rubocop-rspec (2.3.0)
|
110
|
+
rubocop (~> 1.0)
|
111
|
+
rubocop-ast (>= 1.1.0)
|
112
|
+
ruby-progressbar (1.11.0)
|
113
|
+
ruby_parser (3.15.1)
|
105
114
|
sexp_processor (~> 4.9)
|
106
|
-
sexp_processor (4.
|
107
|
-
thor (
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
zeitwerk (2.1.10)
|
115
|
+
sexp_processor (4.15.2)
|
116
|
+
thor (1.1.0)
|
117
|
+
tzinfo (2.0.4)
|
118
|
+
concurrent-ruby (~> 1.0)
|
119
|
+
unicode-display_width (2.0.0)
|
120
|
+
zeitwerk (2.4.2)
|
113
121
|
|
114
122
|
PLATFORMS
|
115
123
|
ruby
|
@@ -127,4 +135,4 @@ DEPENDENCIES
|
|
127
135
|
rubocop-rspec
|
128
136
|
|
129
137
|
BUNDLED WITH
|
130
|
-
2.
|
138
|
+
2.2.17
|
data/config/locales/en.yml
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
en:
|
2
2
|
errors:
|
3
3
|
messages:
|
4
|
+
boolean:
|
5
|
+
all: "must be a true or false value"
|
6
|
+
false_only: "must be a false value"
|
7
|
+
true_only: "must be a true value"
|
4
8
|
csv:
|
5
9
|
in: "csv %{dimension} is not between %{min} and %{max}"
|
6
10
|
greater_than: "csv %{dimension} is not greater than %{count}"
|
data/docs/ALPHA.md
CHANGED
@@ -21,9 +21,9 @@ allow_space | boolean | true, false | false
|
|
21
21
|
```ruby
|
22
22
|
class User < ActiveRecord::Base
|
23
23
|
|
24
|
-
validates :
|
25
|
-
validates :
|
26
|
-
validates :
|
24
|
+
validates :input0, alpha: true
|
25
|
+
validates :input1, alpha: { case: :lower }
|
26
|
+
validates :input2, alpha: { allow_space: true }
|
27
27
|
|
28
28
|
end
|
29
29
|
```
|
data/docs/ALPHA_NUMERIC.md
CHANGED
@@ -21,9 +21,9 @@ allow_space | boolean | true, false | false
|
|
21
21
|
```ruby
|
22
22
|
class User < ActiveRecord::Base
|
23
23
|
|
24
|
-
validates :
|
25
|
-
validates :
|
26
|
-
validates :
|
24
|
+
validates :input0, alpha_numeric: true
|
25
|
+
validates :input1, alpha_numeric: { case: :lower }
|
26
|
+
validates :input2, alpha_numeric: { allow_space: true }
|
27
27
|
|
28
28
|
end
|
29
29
|
```
|
data/docs/BASE64.md
CHANGED
data/docs/BOOLEAN.md
CHANGED
@@ -8,12 +8,19 @@
|
|
8
8
|
'false values' => [false, 0, '0', 'f', 'F', 'false', 'FALSE']
|
9
9
|
```
|
10
10
|
|
11
|
+
#### Options
|
12
|
+
|
13
|
+
Option | Type | Available | Default
|
14
|
+
--- | --- | --- | ---
|
15
|
+
check | symbol | all, false_only, true_only | all
|
16
|
+
|
11
17
|
#### Usage
|
12
18
|
|
13
19
|
```ruby
|
14
20
|
class User < ActiveRecord::Base
|
15
21
|
|
16
|
-
validates :
|
22
|
+
validates :input0, boolean: true
|
23
|
+
validates :input1, boolean: { check: :true_only }
|
17
24
|
|
18
25
|
end
|
19
26
|
```
|
data/docs/COMPARE.md
CHANGED
data/docs/COORDINATE.md
CHANGED
@@ -20,8 +20,8 @@ boundary | symbol | latitude, longitude, pair | pair
|
|
20
20
|
```ruby
|
21
21
|
class User < ActiveRecord::Base
|
22
22
|
|
23
|
-
validates :
|
24
|
-
validates :
|
23
|
+
validates :input0, coordinate: true
|
24
|
+
validates :input1, coordinate: { boundary: :latitude }
|
25
25
|
|
26
26
|
end
|
27
27
|
```
|
data/docs/CREDIT_CARD.md
CHANGED
@@ -22,8 +22,8 @@ provider | symbol | [view here](https://github.com/drexed/lite-validators/blob/m
|
|
22
22
|
```ruby
|
23
23
|
class User < ActiveRecord::Base
|
24
24
|
|
25
|
-
validates :
|
26
|
-
validates :
|
25
|
+
validates :input0, credit_card: true
|
26
|
+
validates :input1, credit_card: { provider: :visa }
|
27
27
|
|
28
28
|
end
|
29
29
|
```
|
data/docs/CSV.md
CHANGED
@@ -36,9 +36,9 @@ not_equal_to | numeric | |
|
|
36
36
|
```ruby
|
37
37
|
class User < ActiveRecord::Base
|
38
38
|
|
39
|
-
validates :
|
40
|
-
validates :
|
41
|
-
validates :
|
39
|
+
validates :input0, csv: { columns: { less_than: 100 } }
|
40
|
+
validates :input1, csv: { rows: { in: (50..100) } }
|
41
|
+
validates :input2, csv: { columns: { equal_to: 5 }, rows: { greater_than: 5 } }
|
42
42
|
|
43
43
|
end
|
44
44
|
```
|
data/docs/CURRENCY.md
CHANGED
data/docs/CUSIP.md
CHANGED
data/docs/EMAIL.md
CHANGED
@@ -18,9 +18,9 @@ domain | array, string, symbol | |
|
|
18
18
|
```ruby
|
19
19
|
class User < ActiveRecord::Base
|
20
20
|
|
21
|
-
validates :
|
22
|
-
validates :
|
23
|
-
validates :
|
21
|
+
validates :input0, email: true
|
22
|
+
validates :input1, email: { domain: 'com' }
|
23
|
+
validates :input2, email: { domain: %w[com org] }
|
24
24
|
|
25
25
|
end
|
26
26
|
```
|