can_has_validations 1.3.2 → 1.4.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: 3e81561f7a3d00cd1e760d29b9e529d51eb841e5b09bc91832fb4b4f0dbc71a1
4
- data.tar.gz: 4ddd43af1f9f5397185d491ee7f38191f2c00bcc15a0a2c78b339ad88ddbd725
3
+ metadata.gz: 35a018491f2cdaaf42b335b1d161573555a41b10f3a01b3789e51afbc8b75a0e
4
+ data.tar.gz: acfa4a74d6709f9184fe46d24eef3fa36771c0f1a540fdbd1d75682b49e67bf8
5
5
  SHA512:
6
- metadata.gz: 30e3b36920d45b0d8e9b0d12ef404b03eb838aa12b905e462b38b407c44c23a91db19f21c7918c396982f69f4afd1afed5585ae795d6d32d4ab93d12aede28a5
7
- data.tar.gz: 668d9ad8cccfa46754a67d7648f046f36a708c67ff98dcfde4c9392f071446cbbfb365211de82370833cbc92cb25ba118eea18002bbdec8ff204b4ef87e5354f
6
+ metadata.gz: ea6a073102cae7965b1f430c169db660f16fcbb826271016a991fef4888401fbb0da206dcd030c61bdf4aab04100d934eaa6efbb76fb12f276f25a1ae30c6a04
7
+ data.tar.gz: 328d8fe59d6e527cc5373a1193654a689c3ff418573b4114fe358475ab5ce1c2a8e64e00ac85bd04cc5a55bd090c276cad4f19711c0919baae6895627958c455
@@ -24,8 +24,8 @@
24
24
  # allows 'a.example.com', but not 'example.com'
25
25
  # validates :domain, hostname: {allow_ip: true} # or 4 or 6 for ipv4 or ipv6 only
26
26
  # allows '1.2.3.4' or 'a.example.com'
27
- # validates :subdomain, hostname: {skip_tld: true, segments: 1}
28
- # allows 'subdomain1'
27
+ # validates :subdomain, hostname: {skip_tld: true}
28
+ # allows 'subdomain1'; implies segments: 1..100 unless otherwise specified
29
29
 
30
30
  require 'resolv'
31
31
 
@@ -46,7 +46,7 @@ module ActiveModel::Validations
46
46
  return if value =~ Resolv::IPv4::Regex || value =~ Resolv::IPv6::Regex
47
47
  end
48
48
 
49
- segments = options[:segments] || (2..100)
49
+ segments = options[:segments] || (options[:skip_tld] ? 1..100 : 2..100)
50
50
  segments = segments..segments if segments.is_a?(Integer)
51
51
  if defined?(Addressable::IDNA)
52
52
  value &&= Addressable::IDNA.to_ascii(value)
@@ -63,6 +63,8 @@ module ActiveModel::Validations
63
63
  is_valid &&= label.length <= 63
64
64
  if !options[:skip_tld] && idx+1==labels.size
65
65
  is_valid &&= label =~ FINAL_LABEL_REGEXP
66
+ elsif options[:allow_wildcard]==:multi && idx==0
67
+ is_valid &&= %w(** *).include?(label) || label =~ LABEL_REGEXP
66
68
  elsif options[:allow_wildcard] && idx==0
67
69
  is_valid &&= label=='*' || label =~ LABEL_REGEXP
68
70
  else
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.3.2'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -45,7 +45,7 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  description: 'Assorted Rails 5.x-6.x validators: Array, Email, Existence, Grandparent,
48
- Hostname, IP address, Ordering, URL, Write Once'
48
+ Hash keys, Hash values, Hostname, IP address, Ordering, URL, Write Once'
49
49
  email:
50
50
  - tm@iprog.com
51
51
  executables: []
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.2.15
124
+ rubygems_version: 3.2.22
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Assorted Rails 5.x-6.x validators