valid_email2 7.0.15 → 7.2.0

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: 0ad947fce2af8a8c580f97e01d0f2b1ad07a0d760b339b39505b97065e290b59
4
- data.tar.gz: 26d8bcde56c018c411275230326b6cacf1353f46f4096de0654307bb357577e6
3
+ metadata.gz: ab3ac120e88c1119add503d1e30e81cd1342ba6c7f47a9714565c12219fb5f75
4
+ data.tar.gz: 4564231489179e5a59c80a23b3ccf484e889630a4dd13190262c5022e3bd20fa
5
5
  SHA512:
6
- metadata.gz: '0709bb5c717b3d746af66da6e58101ef04f0ccd511dfc0397b7652ded537c9b9f7ceaa6248a7df731392d2ac2988e913c24d4dc8a25c6b9f8a2bd59cc72f52eb'
7
- data.tar.gz: 61d4fa93707183759f1f6c0a19bb8113a4aa1c623dc836f5827968d7fd2e990112c3b1e12c65ced337409239bf6a2d173ba426ae4803599374529299278ca014
6
+ metadata.gz: 092e92a411a333b7d8b5e0d0ed447a4e90040fe7a8bf289424a1feed390be6954330d9f3b0d4fc738f8045be922f1214dbaecc8c33475e0a39bfc8de7fafdb35
7
+ data.tar.gz: af1e6b96bf6c5d6d8bb8aa6d8f3e1d1017ef2ebb0ca7b9129468c12a5fc22809f6a8f885daa5c59bbce36d6e871c4777c341e960a0a7af02e196ae74e860496d
@@ -5,13 +5,8 @@ jobs:
5
5
  strategy:
6
6
  fail-fast: false
7
7
  matrix:
8
- gemfile: [activemodel6, activemodel7, activemodel8]
9
- ruby: [3.1, 3.2, 3.3, 3.4]
10
- exclude:
11
- - gemfile: activemodel6
12
- ruby: 3.4
13
- - gemfile: activemodel8
14
- ruby: 3.1
8
+ gemfile: [activemodel7, activemodel8]
9
+ ruby: [3.2, 3.3, 3.4, 4.0]
15
10
  runs-on: ubuntu-latest
16
11
  env:
17
12
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .bundle
5
5
  .config
6
6
  .yardoc
7
+ .byebug_history
7
8
  Gemfile.lock
8
9
  gemfiles/*.gemfile.lock
9
10
  InstalledFiles
@@ -1 +1 @@
1
- {".":"7.0.15"}
1
+ {".":"7.2.0"}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.2.0](https://github.com/micke/valid_email2/compare/v7.1.0...v7.2.0) (2026-11-11)
4
+
5
+
6
+ ### Features
7
+
8
+ * optionally look up disposable domains without building a Set of them ([#326](https://github.com/micke/valid_email2/issues/326)) ([edb46ea](https://github.com/micke/valid_email2/commit/edb46eae949fa25ad635697570968b4bc2550a07))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * keep checking MX hosts after an unlisted host with one dot ([#330](https://github.com/micke/valid_email2/issues/330)) ([a90d66c](https://github.com/micke/valid_email2/commit/a90d66cb0adb693c08b8ba797a9725505904a4ec))
14
+ * make the DNS cache thread-safe with ActiveSupport::Cache::MemoryStore ([#335](https://github.com/micke/valid_email2/issues/335)) ([96ef31b](https://github.com/micke/valid_email2/commit/96ef31bc9e89737f43904f21e57399dad6a62ad1))
15
+
16
+
17
+ ### Performance Improvements
18
+
19
+ * check the allow list before disposable? in disposable_with_allow_list ([#331](https://github.com/micke/valid_email2/issues/331)) ([6f023d8](https://github.com/micke/valid_email2/commit/6f023d8644caaf2773fad511db439406776f3b4a))
20
+
21
+ ## [7.1.0](https://github.com/micke/valid_email2/compare/v7.0.15...v7.1.0) (2026-08-23)
22
+
23
+ ### Features
24
+
25
+ * add custom error-messages for validation purposes https://github.com/micke/valid_email2/pull/313
26
+
27
+ ### Bug Fixes
28
+
29
+ * validate domain hostname rules per label ([d4b80b4](https://github.com/micke/valid_email2/commit/d4b80b42ecb3c262237035fa7454d7e1881d9db6))
30
+ * add pipe | to hostname forbidden characters
31
+ * update the list of deny-listed domains
32
+
3
33
  ## [7.0.15](https://github.com/micke/valid_email2/compare/v7.0.14...v7.0.15) (2026-02-22)
4
34
 
5
35
 
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in valid_email2.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem "byebug", require: false
8
+ gem "ruby-lsp-rspec", require: false
9
+ end
data/README.md CHANGED
@@ -112,6 +112,26 @@ To validate create your own custom message:
112
112
  validates :email, 'valid_email_2/email': { message: "is not a valid email" }
113
113
  ```
114
114
 
115
+ To validate create your dedicated validation error-message:
116
+ ```yaml
117
+ # set custom validation messages for each type of check in translations ie en.yml
118
+ errors:
119
+ messages:
120
+ disallow_dotted: "contains a dot"
121
+ disallow_subaddressing: "..."
122
+ disposable: "..."
123
+ disposable_domain: "..."
124
+ disposable_with_allow_list: "..."
125
+ disposable_domain_with_allow_list: "..."
126
+ deny_list: "..."
127
+ mx: "..."
128
+ strict_mx: "..."
129
+ ```
130
+
131
+ ```ruby
132
+ validates :email, 'valid_email_2/email': { disallow_dotted: true, specific_error_messages: true }
133
+ ```
134
+
115
135
  To allow multiple addresses separated by comma:
116
136
  ```ruby
117
137
  validates :email, 'valid_email_2/email': { multiple: true }
@@ -145,6 +165,32 @@ If you want to allow multibyte characters, set it explicitly.
145
165
  ValidEmail2::Address.permitted_multibyte_characters_regex = /[ÆæØøÅåÄäÖöÞþÐð]/
146
166
  ```
147
167
 
168
+ ### Memory usage of the disposable domains list
169
+
170
+ By default, the disposable domains are loaded into a `Set` (`ValidEmail2.disposable_emails`), which adds about 35 MB to the process for the fastest lookups.
171
+ To trade lookup speed for memory, look them up in the sorted list file instead: it takes about 3 MB, and a lookup takes a few microseconds.
172
+
173
+ ```ruby
174
+ # config/initializers/valid_email2.rb
175
+ ValidEmail2.disposable_domains_lookup = :sorted_list
176
+ ```
177
+
178
+ With this option, domains added to or removed from `ValidEmail2.disposable_emails` are ignored by the validations.
179
+
180
+ ### DNS cache
181
+
182
+ MX and A lookups are cached in memory for the TTL of their DNS records, and the cache is shared by all threads.
183
+ It is an `ActiveSupport::Cache::MemoryStore` capped at 1 MB by default, which holds roughly a thousand domains.
184
+ Once it is full, the least recently used lookups are evicted, and ActiveSupport instruments a `cache_prune.active_support` event.
185
+
186
+ To change the cap, set it in bytes, e.g. in an initializer:
187
+
188
+ ```ruby
189
+ ValidEmail2::Dns.cache_size = 8 * 1024 * 1024 # 8 MB
190
+ ```
191
+
192
+ To empty the cache, e.g. between tests, call `ValidEmail2::Dns.clear_cache`.
193
+
148
194
  ### Test environment
149
195
 
150
196
  If you are validating `mx` then your specs will fail without an internet connection.