lite-validators 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile.lock +66 -65
  5. data/lib/lite/validators/alpha_validator.rb +1 -1
  6. data/lib/lite/validators/base64_validator.rb +1 -3
  7. data/lib/lite/validators/boolean_validator.rb +1 -1
  8. data/lib/lite/validators/compare_validator.rb +1 -1
  9. data/lib/lite/validators/coordinate_validator.rb +1 -1
  10. data/lib/lite/validators/credit_card_validator.rb +1 -1
  11. data/lib/lite/validators/csv_validator.rb +1 -1
  12. data/lib/lite/validators/currency_validator.rb +1 -1
  13. data/lib/lite/validators/cusip_validator.rb +1 -1
  14. data/lib/lite/validators/ein_validator.rb +1 -1
  15. data/lib/lite/validators/email_validator.rb +2 -2
  16. data/lib/lite/validators/file_size_validator.rb +1 -1
  17. data/lib/lite/validators/hex_validator.rb +1 -1
  18. data/lib/lite/validators/imei_validator.rb +1 -1
  19. data/lib/lite/validators/ip_address_validator.rb +1 -1
  20. data/lib/lite/validators/isbn_validator.rb +1 -1
  21. data/lib/lite/validators/isin_validator.rb +1 -1
  22. data/lib/lite/validators/mac_address_validator.rb +1 -1
  23. data/lib/lite/validators/name_validator.rb +1 -1
  24. data/lib/lite/validators/password_validator.rb +1 -1
  25. data/lib/lite/validators/phone_number_validator.rb +1 -1
  26. data/lib/lite/validators/railtie.rb +1 -1
  27. data/lib/lite/validators/sedol_validator.rb +2 -2
  28. data/lib/lite/validators/slug_validator.rb +1 -1
  29. data/lib/lite/validators/ssn_validator.rb +1 -1
  30. data/lib/lite/validators/url_validator.rb +1 -1
  31. data/lib/lite/validators/username_validator.rb +1 -1
  32. data/lib/lite/validators/uuid_validator.rb +1 -1
  33. data/lib/lite/validators/version.rb +1 -1
  34. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1be3cd4946e7ee9b2cd3f5990eb9fd3198bb259f6a445f9210d1ad6a6b1faaa3
4
- data.tar.gz: d001d6846a211a1c012728bc079fdd8c826f084d10b7615f65a356a7f9bf73bd
3
+ metadata.gz: 5c80e1764c537172b0a2fb0dd79a1e11440af9f0b7ba0d02c9a02aaac986e52c
4
+ data.tar.gz: e1af8a2b53184eb5dc6f3ba18e053d199077c4ccdcb90b06eb3018fc3a05f0bf
5
5
  SHA512:
6
- metadata.gz: de257879224b9b795f092e274343b3144f313bbdd78ea35eb5137b8158a2cae711f61156179d10cc597932db348897346ca8bf5238ca973bc6dbcce9d11577ac
7
- data.tar.gz: 36ed0841dca53ee8570afdcdd76e12d793b8a9e797a06b73379307978294ae4a0ff3a5f292fa52d5f73fe9ddb14254a1289236f23d669e9b08bf8c777ea43936
6
+ metadata.gz: 1be9d44a2182f48ebf5ec848dbf741e5d947b1baa5bc07d0ad0d0c0197a8f9d1f1b8ac15c221bf1cfaa05d70332387a60261f0a4d1f731efd026cc399b80757e
7
+ data.tar.gz: fa6954479d3eb3d90aa44a05a95f194d71cf4f87d92b34de2924e946520312965d1681ee9fb4984bb2bf945031f83dc0348777c2fe3e9e13092788d52efd5686
data/.rubocop.yml CHANGED
@@ -23,6 +23,8 @@ Layout/SpaceAroundMethodCallOperator:
23
23
  Enabled: true
24
24
  Lint/ConstantDefinitionInBlock:
25
25
  Enabled: false
26
+ Lint/EmptyClass:
27
+ Enabled: false
26
28
  Lint/RaiseException:
27
29
  Enabled: true
28
30
  Lint/StructNewOverride:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ 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
+
9
13
  ## [1.1.1] - 2020-06-06
10
14
  ### Updated
11
15
  - Improve mac address regex
data/Gemfile.lock CHANGED
@@ -1,56 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-validators (1.1.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.0.3.4)
11
- actionview (= 6.0.3.4)
12
- activesupport (= 6.0.3.4)
13
- rack (~> 2.0, >= 2.0.8)
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.3.4)
18
- activesupport (= 6.0.3.4)
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.3.4)
24
- activesupport (= 6.0.3.4)
25
- activesupport (6.0.3.4)
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.2, >= 2.2.2)
31
- ast (2.4.1)
27
+ i18n (>= 1.6, < 2)
28
+ minitest (>= 5.1)
29
+ tzinfo (~> 2.0)
30
+ zeitwerk (~> 2.3)
31
+ ast (2.4.2)
32
32
  builder (3.2.4)
33
33
  colorize (0.8.1)
34
- concurrent-ruby (1.1.7)
34
+ concurrent-ruby (1.1.8)
35
35
  crass (1.0.6)
36
36
  diff-lcs (1.4.4)
37
- erubi (1.9.0)
38
- fasterer (0.8.3)
37
+ erubi (1.10.0)
38
+ fasterer (0.9.0)
39
39
  colorize (~> 0.7)
40
40
  ruby_parser (>= 3.14.1)
41
- i18n (1.8.5)
41
+ i18n (1.8.10)
42
42
  concurrent-ruby (~> 1.0)
43
- loofah (2.7.0)
43
+ loofah (2.9.1)
44
44
  crass (~> 1.0.2)
45
45
  nokogiri (>= 1.5.9)
46
46
  method_source (1.0.0)
47
- mini_portile2 (2.4.0)
48
- minitest (5.14.2)
49
- nokogiri (1.10.10)
50
- mini_portile2 (~> 2.4.0)
51
- parallel (1.19.2)
52
- parser (2.7.2.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)
53
54
  ast (~> 2.4.1)
55
+ racc (1.5.2)
54
56
  rack (2.2.3)
55
57
  rack-test (1.1.0)
56
58
  rack (>= 1.0, < 3)
@@ -59,64 +61,63 @@ GEM
59
61
  nokogiri (>= 1.6)
60
62
  rails-html-sanitizer (1.3.0)
61
63
  loofah (~> 2.3)
62
- railties (6.0.3.4)
63
- actionpack (= 6.0.3.4)
64
- activesupport (= 6.0.3.4)
64
+ railties (6.1.3.2)
65
+ actionpack (= 6.1.3.2)
66
+ activesupport (= 6.1.3.2)
65
67
  method_source
66
68
  rake (>= 0.8.7)
67
- thor (>= 0.20.3, < 2.0)
69
+ thor (~> 1.0)
68
70
  rainbow (3.0.0)
69
- rake (13.0.1)
70
- regexp_parser (1.8.2)
71
- rexml (3.2.4)
71
+ rake (13.0.3)
72
+ regexp_parser (2.1.1)
73
+ rexml (3.2.5)
72
74
  rspec (3.10.0)
73
75
  rspec-core (~> 3.10.0)
74
76
  rspec-expectations (~> 3.10.0)
75
77
  rspec-mocks (~> 3.10.0)
76
- rspec-core (3.10.0)
78
+ rspec-core (3.10.1)
77
79
  rspec-support (~> 3.10.0)
78
- rspec-expectations (3.10.0)
80
+ rspec-expectations (3.10.1)
79
81
  diff-lcs (>= 1.2.0, < 2.0)
80
82
  rspec-support (~> 3.10.0)
81
- rspec-mocks (3.10.0)
83
+ rspec-mocks (3.10.2)
82
84
  diff-lcs (>= 1.2.0, < 2.0)
83
85
  rspec-support (~> 3.10.0)
84
- rspec-rails (4.0.1)
85
- actionpack (>= 4.2)
86
- activesupport (>= 4.2)
87
- railties (>= 4.2)
88
- rspec-core (~> 3.9)
89
- rspec-expectations (~> 3.9)
90
- rspec-mocks (~> 3.9)
91
- rspec-support (~> 3.9)
92
- rspec-support (3.10.0)
93
- rubocop (1.2.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.7.1.5)
97
+ parser (>= 3.0.0.0)
96
98
  rainbow (>= 2.2.2, < 4.0)
97
- regexp_parser (>= 1.8)
99
+ regexp_parser (>= 1.8, < 3.0)
98
100
  rexml
99
- rubocop-ast (>= 1.0.1)
101
+ rubocop-ast (>= 1.5.0, < 2.0)
100
102
  ruby-progressbar (~> 1.7)
101
- unicode-display_width (>= 1.4.0, < 2.0)
102
- rubocop-ast (1.1.1)
103
- parser (>= 2.7.1.5)
104
- rubocop-performance (1.8.1)
105
- rubocop (>= 0.87.0)
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)
106
108
  rubocop-ast (>= 0.4.0)
107
- rubocop-rspec (2.0.0)
109
+ rubocop-rspec (2.3.0)
108
110
  rubocop (~> 1.0)
109
111
  rubocop-ast (>= 1.1.0)
110
- ruby-progressbar (1.10.1)
111
- ruby_parser (3.15.0)
112
+ ruby-progressbar (1.11.0)
113
+ ruby_parser (3.15.1)
112
114
  sexp_processor (~> 4.9)
113
- sexp_processor (4.15.1)
114
- thor (1.0.1)
115
- thread_safe (0.3.6)
116
- tzinfo (1.2.7)
117
- thread_safe (~> 0.1)
118
- unicode-display_width (1.7.0)
119
- zeitwerk (2.4.1)
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)
120
121
 
121
122
  PLATFORMS
122
123
  ruby
@@ -134,4 +135,4 @@ DEPENDENCIES
134
135
  rubocop-rspec
135
136
 
136
137
  BUNDLED WITH
137
- 2.1.4
138
+ 2.2.17
@@ -2,7 +2,7 @@
2
2
 
3
3
  class AlphaValidator < BaseValidator
4
4
 
5
- CASES ||= {
5
+ CASES = {
6
6
  lower: 'a-z',
7
7
  upper: 'A-Z',
8
8
  any: 'A-Za-z'
@@ -2,8 +2,6 @@
2
2
 
3
3
  class Base64Validator < BaseValidator
4
4
 
5
- # rubocop:disable Layout/LineLength
6
- REGEXP ||= /^(?:[A-Za-z0-9+$]{4})*(?:[A-Za-z0-9+$]{2}==|[A-Za-z0-9+$]{3}=|[A-Za-z0-9+$]{4})$/.freeze
7
- # rubocop:enable Layout/LineLength
5
+ REGEXP = /^(?:[A-Za-z0-9+$]{4})*(?:[A-Za-z0-9+$]{2}==|[A-Za-z0-9+$]{3}=|[A-Za-z0-9+$]{4})$/.freeze
8
6
 
9
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class BooleanValidator < BaseValidator
4
4
 
5
- CHECKS ||= {
5
+ CHECKS = {
6
6
  all: nil,
7
7
  false_only: %w[0 f false n no off],
8
8
  true_only: %w[1 t true y yes on]
@@ -2,7 +2,7 @@
2
2
 
3
3
  class CompareValidator < BaseValidator
4
4
 
5
- CHECKS ||= {
5
+ CHECKS = {
6
6
  less_than: :<,
7
7
  less_than_or_equal_to: :<=,
8
8
  greater_than: :>,
@@ -2,7 +2,7 @@
2
2
 
3
3
  class CoordinateValidator < BaseValidator
4
4
 
5
- BOUNDARIES ||= {
5
+ BOUNDARIES = {
6
6
  latitude: 90.0,
7
7
  longitude: 180.0
8
8
  }.freeze
@@ -4,7 +4,7 @@ class CreditCardValidator < BaseValidator
4
4
 
5
5
  # NOTE: https://en.wikipedia.org/wiki/Payment_card_value#Issuer_identification_value_.28IIN.29
6
6
 
7
- PROVIDERS ||= {
7
+ PROVIDERS = {
8
8
  american_express: {
9
9
  sizes: [15],
10
10
  prefixes: [34, 37]
@@ -4,7 +4,7 @@ require 'csv'
4
4
 
5
5
  class CsvValidator < FileSizeValidator
6
6
 
7
- DIMENSIONS ||= %i[
7
+ DIMENSIONS = %i[
8
8
  columns rows
9
9
  ].freeze
10
10
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  class CurrencyValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^\d*+(\.\d{1,2})$/.freeze
5
+ REGEXP = /^\d*+(\.\d{1,2})$/.freeze
6
6
 
7
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class CusipValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^[0-9A-Z]{9}$/.freeze
5
+ REGEXP = /^[0-9A-Z]{9}$/.freeze
6
6
 
7
7
  private
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  class EinValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^[1-9]\d?-\d{7}$/.freeze
5
+ REGEXP = /^[1-9]\d?-\d{7}$/.freeze
6
6
 
7
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class EmailValidator < BaseValidator
4
4
 
5
- REGEXP ||= /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.freeze
5
+ REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.freeze
6
6
 
7
7
  private
8
8
 
@@ -13,7 +13,7 @@ class EmailValidator < BaseValidator
13
13
  def valid_domain?
14
14
  return true unless options.key?(:domain)
15
15
 
16
- [options[:domain]].flatten.any? { |domain| value.downcase.end_with?(".#{domain.downcase}") }
16
+ Array(options[:domain]).any? { |domain| value.downcase.end_with?(".#{domain.downcase}") }
17
17
  end
18
18
 
19
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class FileSizeValidator < BaseValidator
4
4
 
5
- CHECKS ||= {
5
+ CHECKS = {
6
6
  in: :===,
7
7
  less_than: :<,
8
8
  less_than_or_equal_to: :<=,
@@ -2,6 +2,6 @@
2
2
 
3
3
  class HexValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.freeze
5
+ REGEXP = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.freeze
6
6
 
7
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class ImeiValidator < BaseValidator
4
4
 
5
- REGEXP ||= /\A[\d.:\-\s]+\z/i.freeze
5
+ REGEXP = /\A[\d.:\-\s]+\z/i.freeze
6
6
 
7
7
  private
8
8
 
@@ -4,7 +4,7 @@ require 'resolv'
4
4
 
5
5
  class IpAddressValidator < BaseValidator
6
6
 
7
- REGEXP ||= {
7
+ REGEXP = {
8
8
  ipv4: Resolv::IPv4::Regex,
9
9
  ipv6: Resolv::IPv6::Regex
10
10
  }.freeze
@@ -2,7 +2,7 @@
2
2
 
3
3
  class IsbnValidator < BaseValidator
4
4
 
5
- CHARACTERS ||= %w[
5
+ CHARACTERS = %w[
6
6
  0 1 2 3 4 5 6 7 8 9 x
7
7
  ].freeze
8
8
 
@@ -3,7 +3,7 @@
3
3
  class IsinValidator < BaseValidator
4
4
 
5
5
  # rubocop:disable Layout/LineLength
6
- REGEXP ||= /^((AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW{2})([A-Z0-9]{9}))(\d{1})$/.freeze
6
+ REGEXP = /^((AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW{2})([A-Z0-9]{9}))(\d{1})$/.freeze
7
7
  # rubocop:enable Layout/LineLength
8
8
 
9
9
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  class MacAddressValidator < BaseValidator
4
4
 
5
- REGEXP ||= [
5
+ REGEXP = [
6
6
  /^(\h{2}[-|.:\s]){5}\h{2}?$/i,
7
7
  /^(\h{4}[-|.:\s]){2}\h{4}?$/i,
8
8
  /^(\h{6}[-|.:\s])\h{6}?$/i,
@@ -2,6 +2,6 @@
2
2
 
3
3
  class NameValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^([A-Za-z'"-]+\s+){1,4}[A-Za-z'"-]*\z/.freeze
5
+ REGEXP = /^([A-Za-z'"-]+\s+){1,4}[A-Za-z'"-]*\z/.freeze
6
6
 
7
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class PasswordValidator < BaseValidator
4
4
 
5
- REGEXP ||= {
5
+ REGEXP = {
6
6
  strong: /\A(?=.{4,255})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[[:^alnum:]])/x,
7
7
  weak: /^[A-Za-z0-9.,<>:;!@#$%^&*?_~-]{1,255}$/
8
8
  }.freeze
@@ -2,6 +2,6 @@
2
2
 
3
3
  class PhoneNumberValidator < BaseValidator
4
4
 
5
- REGEXP ||= %r{^[0-9+()#.\s/ext-]+$}.freeze
5
+ REGEXP = %r{^[0-9+()#.\s/ext-]+$}.freeze
6
6
 
7
7
  end
@@ -8,7 +8,7 @@ module Lite
8
8
 
9
9
  initializer 'lite-validators' do |app|
10
10
  Lite::Validators::Railtie.instance_eval do
11
- [app.config.i18n.available_locales].flatten.each do |locale|
11
+ Array(app.config.i18n.available_locales).each do |locale|
12
12
  path = File.expand_path("../../../config/locales/#{locale}.yml", __FILE__)
13
13
  next if !File.file?(path) || I18n.load_path.include?(path)
14
14
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  class SedolValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^([A-Z0-9]{6})(\d{1})$/.freeze
6
- WEIGHTS ||= [
5
+ REGEXP = /^([A-Z0-9]{6})(\d{1})$/.freeze
6
+ WEIGHTS = [
7
7
  1, 3, 1, 7, 3, 9, 1
8
8
  ].freeze
9
9
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  class SlugValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^[A-Za-z0-9_-]+$/i.freeze
5
+ REGEXP = /^[A-Za-z0-9_-]+$/i.freeze
6
6
 
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class SsnValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^\A(\d{3}-\d{2}-\d{4}|\d{9})\Z$/.freeze
5
+ REGEXP = /^\A(\d{3}-\d{2}-\d{4}|\d{9})\Z$/.freeze
6
6
 
7
7
  end
@@ -4,7 +4,7 @@ require 'uri'
4
4
 
5
5
  class UrlValidator < BaseValidator
6
6
 
7
- SCHEMES ||= %w[
7
+ SCHEMES = %w[
8
8
  http https
9
9
  ].freeze
10
10
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  class UsernameValidator < BaseValidator
4
4
 
5
- REGEXP ||= /^[A-Za-z0-9._-]{1,255}$/.freeze
5
+ REGEXP = /^[A-Za-z0-9._-]{1,255}$/.freeze
6
6
 
7
7
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class UuidValidator < BaseValidator
4
4
 
5
- VERSIONS ||= {
5
+ VERSIONS = {
6
6
  any: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
7
7
  3 => /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
8
8
  4 => /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Validators
5
5
 
6
- VERSION ||= '1.1.1'
6
+ VERSION = '1.1.2'
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-07 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.1.4
263
+ rubygems_version: 3.2.17
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: Collection of ActiveModel/ActiveRecord validators