can_has_validations 1.11.0 → 1.12.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: 265cc0daee73649e7814d073dcb6243a700fc95d44465a3e65d8873c747d70fc
4
- data.tar.gz: 38ed63f29a3801450380bb3024279ddfdcbd018a68bfca9a57fa3a7d057e7982
3
+ metadata.gz: 13e394fba7dc57b9c99ee269fe7c1bbb868e3f5622ed98a2b142a5ffc7ca4fec
4
+ data.tar.gz: bf2d29c9de0698c7cc9bc734534e556f7b6625f61ba032cef15ccb71f4e7ac70
5
5
  SHA512:
6
- metadata.gz: 00ddc79d0260617c6b4563bc80d0d3e9f3e265c1a635c91f0be6b785efd57ff453d76a9d0146d536771e8f7cd1e17d2d1a8d5716c6c5b8f3839f5669735f0c47
7
- data.tar.gz: d7903a4fb900618b36020e56207391c6c88bb31d77d6fc524c003015852f17e8e6837561bf057eee73ed83a6e0e6f220f931dc2507fadea1cb793fed34095625
6
+ metadata.gz: 64c45df4c4266413b999c21aff1356ddfb2178e7dc54e115638f9b08c6a50c2f12c237a2573ecd4684665b3b7690cd408cc4b5b8f58ba34dd74f5a8e520b6436
7
+ data.tar.gz: b6b3ec67d6711a4e8a6fabcf1ee018bf58f003fc29f0500e5bec21d85e34d9104ec5ccc2dfe46f4f4a287d986cb0f44872bcf0ed5e3dbe14f55c521ef283c5d6
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012-2025 thomas morgan
1
+ Copyright 2012-2026 thomas morgan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -29,7 +29,7 @@ module ActiveModel::Validations
29
29
  is_valid &&= recipient !~ /\.\./
30
30
  is_valid &&= !recipient.starts_with?('.')
31
31
  is_valid &&= !recipient.ends_with?('.')
32
- recipient.split('.').each do |segment|
32
+ recipient.split('.', -1).each do |segment|
33
33
  is_valid &&= segment =~ SEGMENT_REGEXP
34
34
  end
35
35
 
@@ -37,7 +37,7 @@ module ActiveModel::Validations
37
37
  if allow_unicode && defined?(Addressable::IDNA)
38
38
  domain &&= Addressable::IDNA.to_ascii(domain)
39
39
  end
40
- labels = domain.split('.')
40
+ labels = domain.split('.', -1)
41
41
  is_valid &&= domain.length <= 255
42
42
  is_valid &&= domain !~ /\.\./
43
43
  is_valid &&= labels.size.in? 2..100
@@ -7,6 +7,9 @@
7
7
  # validates :database, url: {port: [5432, nil]}
8
8
  # to allow scheme's default port, must specify `nil` too
9
9
  # :scheme defaults to `%w(http https)`
10
+ # to allow any, use `scheme: nil`
11
+ # to require blank, use `scheme: [nil]`
12
+ # note: to allow no scheme, uri must still start with '//'
10
13
  # :host defaults to `nil` which allows any
11
14
  # :port defaults to `nil` which allows any
12
15
  # to require blank, use `port: false` or `port: [nil]`
@@ -26,6 +29,8 @@ module ActiveModel::Validations
26
29
  options[:scheme].call(record)
27
30
  elsif options[:scheme].is_a?(Symbol)
28
31
  record.send(options[:scheme])
32
+ elsif options.key?(:scheme) && options[:scheme].nil?
33
+ [u&.scheme]
29
34
  else
30
35
  Array.wrap(options[:scheme] || %w(http https))
31
36
  end
@@ -54,7 +59,7 @@ module ActiveModel::Validations
54
59
  Array.wrap(options[:port])
55
60
  end
56
61
 
57
- if !u || !u2 || u.relative? || allowed_schemes.exclude?(u.scheme) || allowed_hosts.exclude?(u.host) || allowed_ports.exclude?(u.port)
62
+ if !u || !u2 || allowed_schemes.exclude?(u.scheme) || allowed_hosts.exclude?(u.host) || allowed_ports.exclude?(u.port)
58
63
  record.errors.add(attribute, :invalid_url, **options.merge(value: value, scheme: allowed_schemes, host: allowed_hosts, port: allowed_ports))
59
64
  end
60
65
  end
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.11.0'
2
+ VERSION = '1.12.0'
3
3
  end
@@ -111,3 +111,17 @@ CanHasValidationsTest: test_truth
111
111
  CanHasValidationsTest: test_truth
112
112
  ---------------------------------
113
113
  TRANSACTION (0.0ms) ROLLBACK TRANSACTION
114
+ Generating image variants require the image_processing gem. Please add `gem "image_processing", "~> 1.2"` to your Gemfile or set `config.active_storage.variant_processor = :disabled`.
115
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
116
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
117
+ ---------------------------------
118
+ CanHasValidationsTest: test_truth
119
+ ---------------------------------
120
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
121
+ Generating image variants require the image_processing gem. Please add `gem "image_processing", "~> 1.2"` to your Gemfile or set `config.active_storage.variant_processor = :disabled`.
122
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
123
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
124
+ ---------------------------------
125
+ CanHasValidationsTest: test_truth
126
+ ---------------------------------
127
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '7.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: minitest
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: rake
28
42
  requirement: !ruby/object:Gem::Requirement