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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +18 -3
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +20 -0
  5. data/Gemfile.lock +86 -78
  6. data/config/locales/en.yml +4 -0
  7. data/docs/ALPHA.md +3 -3
  8. data/docs/ALPHA_NUMERIC.md +3 -3
  9. data/docs/BASE64.md +1 -1
  10. data/docs/BOOLEAN.md +8 -1
  11. data/docs/COMPARE.md +1 -1
  12. data/docs/COORDINATE.md +2 -2
  13. data/docs/CREDIT_CARD.md +2 -2
  14. data/docs/CSV.md +3 -3
  15. data/docs/CURRENCY.md +1 -1
  16. data/docs/CUSIP.md +1 -1
  17. data/docs/EMAIL.md +3 -3
  18. data/docs/FILE_CONTENT_TYPE.md +3 -3
  19. data/docs/FILE_EXTENSION.md +2 -2
  20. data/docs/FILE_SIZE.md +3 -3
  21. data/docs/HEX.md +1 -1
  22. data/docs/IMEI.md +1 -1
  23. data/docs/IP_ADDRESS.md +2 -2
  24. data/docs/ISBN.md +1 -1
  25. data/docs/ISIN.md +1 -1
  26. data/docs/MAC_ADDRESS.md +1 -1
  27. data/docs/NAME.md +1 -1
  28. data/docs/PASSWORD.md +2 -2
  29. data/docs/PHONE_NUMBER.md +1 -1
  30. data/docs/SEDOL.md +1 -1
  31. data/docs/SLUG.md +1 -1
  32. data/docs/SSN.md +1 -1
  33. data/docs/TIME_ZONE.md +1 -1
  34. data/docs/TYPE.md +5 -5
  35. data/docs/URL.md +4 -4
  36. data/docs/USERNAME.md +2 -2
  37. data/docs/UUID.md +2 -2
  38. data/lib/lite/validators/alpha_validator.rb +1 -1
  39. data/lib/lite/validators/base64_validator.rb +1 -3
  40. data/lib/lite/validators/base_validator.rb +3 -3
  41. data/lib/lite/validators/boolean_validator.rb +24 -4
  42. data/lib/lite/validators/compare_validator.rb +1 -1
  43. data/lib/lite/validators/coordinate_validator.rb +1 -1
  44. data/lib/lite/validators/credit_card_validator.rb +2 -2
  45. data/lib/lite/validators/csv_validator.rb +4 -4
  46. data/lib/lite/validators/currency_validator.rb +1 -1
  47. data/lib/lite/validators/cusip_validator.rb +1 -1
  48. data/lib/lite/validators/ein_validator.rb +1 -1
  49. data/lib/lite/validators/email_validator.rb +2 -2
  50. data/lib/lite/validators/file_content_type_validator.rb +1 -1
  51. data/lib/lite/validators/file_extension_validator.rb +1 -3
  52. data/lib/lite/validators/file_size_validator.rb +4 -4
  53. data/lib/lite/validators/hex_validator.rb +1 -1
  54. data/lib/lite/validators/imei_validator.rb +1 -1
  55. data/lib/lite/validators/ip_address_validator.rb +1 -1
  56. data/lib/lite/validators/isbn_validator.rb +1 -1
  57. data/lib/lite/validators/isin_validator.rb +6 -6
  58. data/lib/lite/validators/mac_address_validator.rb +5 -5
  59. data/lib/lite/validators/name_validator.rb +1 -1
  60. data/lib/lite/validators/password_validator.rb +1 -1
  61. data/lib/lite/validators/phone_number_validator.rb +1 -1
  62. data/lib/lite/validators/railtie.rb +1 -1
  63. data/lib/lite/validators/sedol_validator.rb +2 -2
  64. data/lib/lite/validators/slug_validator.rb +1 -1
  65. data/lib/lite/validators/ssn_validator.rb +1 -1
  66. data/lib/lite/validators/type_validator.rb +1 -1
  67. data/lib/lite/validators/url_validator.rb +5 -5
  68. data/lib/lite/validators/username_validator.rb +1 -1
  69. data/lib/lite/validators/uuid_validator.rb +1 -1
  70. data/lib/lite/validators/version.rb +1 -1
  71. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f204fb7b34f2071f2ceb2ff58776eb169c134c6e59de1388232475a6635c8f5
4
- data.tar.gz: c6dd398a13a3a743e9e298e6a17d8e0eb6db253a5f45c02b44490df1fbb2086b
3
+ metadata.gz: 5c80e1764c537172b0a2fb0dd79a1e11440af9f0b7ba0d02c9a02aaac986e52c
4
+ data.tar.gz: e1af8a2b53184eb5dc6f3ba18e053d199077c4ccdcb90b06eb3018fc3a05f0bf
5
5
  SHA512:
6
- metadata.gz: 7849297d55cee50fc889a2a3c3e15d24dc05ebd0a00e17bfa2436c2446fcf2eb6aae390a00a40bdea863cc02290c88cb16b7c4157da99931b1852bf6e796df0b
7
- data.tar.gz: 877d01ccb4519144292784c9038b84a2ecbbf48ca16fddbcd872bc237ecd0361d6c6178723a396f96ea4156ca3deda39e4bfe4d311fbffa7ebdca4f8b9a40523
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.6
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
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
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
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.0.5)
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.0.0)
11
- actionview (= 6.0.0)
12
- activesupport (= 6.0.0)
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.0.0)
18
- activesupport (= 6.0.0)
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.0.0)
24
- activesupport (= 6.0.0)
25
- activesupport (6.0.0)
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 (>= 0.7, < 2)
28
- minitest (~> 5.1)
29
- tzinfo (~> 1.1)
30
- zeitwerk (~> 2.1, >= 2.1.8)
31
- ast (2.4.0)
32
- builder (3.2.3)
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.5)
35
- crass (1.0.4)
36
- diff-lcs (1.3)
37
- erubi (1.8.0)
38
- fasterer (0.6.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.13.0)
41
- i18n (1.6.0)
40
+ ruby_parser (>= 3.14.1)
41
+ i18n (1.8.10)
42
42
  concurrent-ruby (~> 1.0)
43
- jaro_winkler (1.5.3)
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.9.2)
48
- mini_portile2 (2.4.0)
49
- minitest (5.11.3)
50
- nokogiri (1.10.4)
51
- mini_portile2 (~> 2.4.0)
52
- parallel (1.17.0)
53
- parser (2.6.4.0)
54
- ast (~> 2.4.0)
55
- rack (2.0.7)
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.2.0)
62
- loofah (~> 2.2, >= 2.2.2)
63
- railties (6.0.0)
64
- actionpack (= 6.0.0)
65
- activesupport (= 6.0.0)
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 (>= 0.20.3, < 2.0)
69
+ thor (~> 1.0)
69
70
  rainbow (3.0.0)
70
- rake (12.3.3)
71
- rspec (3.8.0)
72
- rspec-core (~> 3.8.0)
73
- rspec-expectations (~> 3.8.0)
74
- rspec-mocks (~> 3.8.0)
75
- rspec-core (3.8.2)
76
- rspec-support (~> 3.8.0)
77
- rspec-expectations (3.8.4)
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.8.0)
80
- rspec-mocks (3.8.1)
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.8.0)
83
- rspec-rails (3.8.2)
84
- actionpack (>= 3.0)
85
- activesupport (>= 3.0)
86
- railties (>= 3.0)
87
- rspec-core (~> 3.8.0)
88
- rspec-expectations (~> 3.8.0)
89
- rspec-mocks (~> 3.8.0)
90
- rspec-support (~> 3.8.0)
91
- rspec-support (3.8.2)
92
- rubocop (0.74.0)
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 (>= 2.6)
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, < 1.7)
99
- rubocop-performance (1.4.1)
100
- rubocop (>= 0.71.0)
101
- rubocop-rspec (1.35.0)
102
- rubocop (>= 0.60.0)
103
- ruby-progressbar (1.10.1)
104
- ruby_parser (3.13.1)
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.12.1)
107
- thor (0.20.3)
108
- thread_safe (0.3.6)
109
- tzinfo (1.2.5)
110
- thread_safe (~> 0.1)
111
- unicode-display_width (1.6.0)
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.0.1
138
+ 2.2.17
@@ -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 :input_0, alpha: true
25
- validates :input_1, alpha: { case: :lower }
26
- validates :input_2, alpha: { allow_space: true }
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
  ```
@@ -21,9 +21,9 @@ allow_space | boolean | true, false | false
21
21
  ```ruby
22
22
  class User < ActiveRecord::Base
23
23
 
24
- validates :input_0, alpha_numeric: true
25
- validates :input_1, alpha_numeric: { case: :lower }
26
- validates :input_2, alpha_numeric: { allow_space: true }
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
@@ -12,7 +12,7 @@
12
12
  ```ruby
13
13
  class User < ActiveRecord::Base
14
14
 
15
- validates :input_0, base64: true
15
+ validates :input0, base64: true
16
16
 
17
17
  end
18
18
  ```
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 :input_0, boolean: true
22
+ validates :input0, boolean: true
23
+ validates :input1, boolean: { check: :true_only }
17
24
 
18
25
  end
19
26
  ```
data/docs/COMPARE.md CHANGED
@@ -24,7 +24,7 @@ to | symbol | |
24
24
  ```ruby
25
25
  class User < ActiveRecord::Base
26
26
 
27
- validates :input_0, equality: { to: :input_1, check: :less_than }
27
+ validates :input0, equality: { to: :input1, check: :less_than }
28
28
 
29
29
  end
30
30
  ```
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 :input_0, coordinate: true
24
- validates :input_1, coordinate: { boundary: :latitude }
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 :input_0, credit_card: true
26
- validates :input_1, credit_card: { provider: :visa }
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 :input_0, csv: { columns: { less_than: 100 } }
40
- validates :input_1, csv: { rows: { in: (50..100) } }
41
- validates :input_2, csv: { columns: { equal_to: 5 }, rows: { greater_than: 5 } }
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
@@ -12,7 +12,7 @@
12
12
  ```ruby
13
13
  class User < ActiveRecord::Base
14
14
 
15
- validates :input_0, currency: true
15
+ validates :input0, currency: true
16
16
 
17
17
  end
18
18
  ```
data/docs/CUSIP.md CHANGED
@@ -14,7 +14,7 @@
14
14
  ```ruby
15
15
  class User < ActiveRecord::Base
16
16
 
17
- validates :input_0, cusip: true
17
+ validates :input0, cusip: true
18
18
 
19
19
  end
20
20
  ```
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 :input_0, email: true
22
- validates :input_1, email: { domain: 'com' }
23
- validates :input_2, email: { domain: %w[com org] }
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
  ```