can_has_validations 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdd7c0ba5910899942ccfa116005b0458596cd475c30495c788fbd72bf25f8f6
4
- data.tar.gz: 1507f461b6c2a10e1084d4e7af494924b168b4db83f318eac672b9ac94b58817
3
+ metadata.gz: 8ebceb28bd42a889a2d7b4d8d589dcdc25bf722d2a1f028de00dabeb92beb826
4
+ data.tar.gz: 6acf11da982dddf4702db8c386af8d0780d940f9b8c4273e881e18fb0a4bc12b
5
5
  SHA512:
6
- metadata.gz: 8e9d0f1333fbd0f77cb45ec67c741f9b63b5609324e919830e7a4076831a2527efd222ede98fabcb4b632ccdc76fc4a4ce048f2e7bd0659504928f80e7dcdc70
7
- data.tar.gz: c85f1eabcbe0e2579dc2ea5917d731088fa7afe0a5da14ddb8a40ccee8a94bca0c6af44405f263a978cad987ce1695e0abbe47ae7d3cfc113fccec153618d0e6
6
+ metadata.gz: 89327c90cb07c1663fbe9cfa245eb62d964499e3b05220de5bc5ed5443f153ea5613249f9e1afec65e5b29c345a43484dd7cafd1988d76a633c97c5ac62819b3
7
+ data.tar.gz: 177ce2aedb07dd299209d8099b52c3344cfa7f157682a3edc67ea27adce8853d51779138f191bb12171de5ab72976c5bd512c80eaa42b1f6575919c580b636a7
@@ -13,7 +13,7 @@ module ActiveModel::Validations
13
13
 
14
14
  def validate_each(record, attribute, value)
15
15
  unless email_valid?(value)
16
- record.errors.add(attribute, :invalid_email, options.merge(value: value))
16
+ record.errors.add(attribute, :invalid_email, **options.merge(value: value))
17
17
  end
18
18
  end
19
19
 
@@ -21,7 +21,7 @@ module ActiveModel::Validations
21
21
  end
22
22
  end
23
23
  unless all_match
24
- record.errors.add(attribute, :invalid, options.except(:allow_nil, :parent, :scope))
24
+ record.errors.add(attribute, :invalid, **options.except(:allow_nil, :parent, :scope))
25
25
  end
26
26
  end
27
27
  end
@@ -71,7 +71,7 @@ module ActiveModel::Validations
71
71
  end
72
72
 
73
73
  unless is_valid
74
- record.errors.add(attribute, :invalid_hostname, options.except(*RESERVED_OPTIONS).merge!(value: value))
74
+ record.errors.add(attribute, :invalid_hostname, **options.except(*RESERVED_OPTIONS).merge!(value: value))
75
75
  end
76
76
  end
77
77
 
@@ -30,17 +30,17 @@ module ActiveModel::Validations
30
30
  IPAddr.new(value) rescue nil
31
31
  end
32
32
  unless ip
33
- record.errors.add(attribute, :invalid_ip, options.merge(value: value))
33
+ record.errors.add(attribute, :invalid_ip, **options.merge(value: value))
34
34
  return
35
35
  end
36
36
 
37
37
  if !options[:allow_block] && (ip.ipv4? && ip.prefix!=32 or ip.ipv6? && ip.prefix!=128)
38
- record.errors.add(attribute, :single_ip_required, options.merge(value: value))
38
+ record.errors.add(attribute, :single_ip_required, **options.merge(value: value))
39
39
  end
40
40
  if allowed_ips && allowed_ips.none?{|blk| blk.include? ip}
41
- record.errors.add(attribute, :ip_not_allowed, options.merge(value: value))
41
+ record.errors.add(attribute, :ip_not_allowed, **options.merge(value: value))
42
42
  elsif disallowed_ips && disallowed_ips.any?{|blk| blk.include? ip}
43
- record.errors.add(attribute, :ip_not_allowed, options.merge(value: value))
43
+ record.errors.add(attribute, :ip_not_allowed, **options.merge(value: value))
44
44
  end
45
45
  end
46
46
 
@@ -18,7 +18,7 @@ module ActiveModel::Validations
18
18
  next unless value && greater
19
19
  unless value < greater
20
20
  attr2 = attr_name.respond_to?(:call) ? 'it is' : record.class.human_attribute_name(attr_name)
21
- record.errors.add(attribute, :before, options.except(:before).merge!(attribute2: attr2, value: value))
21
+ record.errors.add(attribute, :before, **options.except(:before).merge!(attribute2: attr2, value: value))
22
22
  end
23
23
  end
24
24
  end
@@ -33,7 +33,7 @@ module ActiveModel::Validations
33
33
  next unless value && lesser
34
34
  unless value > lesser
35
35
  attr2 = attr_name.respond_to?(:call) ? 'it is' : record.class.human_attribute_name(attr_name)
36
- record.errors.add(attribute, :after, options.except(:after).merge!(attribute2: attr2, value: value))
36
+ record.errors.add(attribute, :after, **options.except(:after).merge!(attribute2: attr2, value: value))
37
37
  end
38
38
  end
39
39
  end
@@ -22,7 +22,7 @@ module ActiveModel::Validations
22
22
  u2 = u = URI.parse(value) rescue nil
23
23
  end
24
24
  if !u || !u2 || u.relative? || allowed_schemes.exclude?(u.scheme)
25
- record.errors.add(attribute, :invalid_url, options.merge(value: value, scheme: allowed_schemes))
25
+ record.errors.add(attribute, :invalid_url, **options.merge(value: value, scheme: allowed_schemes))
26
26
  end
27
27
  end
28
28
  end
@@ -26,7 +26,7 @@ module ActiveModel::Validations
26
26
  if record.send("#{attr2}_changed?")
27
27
  if options[:immutable_nil] || !record.send("#{attr2}_was").nil?
28
28
  value = record.read_attribute_for_validation(attribute)
29
- record.errors.add(attribute, :unchangeable, options.except(:immutable_nil).merge!(value: value))
29
+ record.errors.add(attribute, :unchangeable, **options.except(:immutable_nil).merge!(value: value))
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
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.0
4
+ version: 1.3.1
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-14 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails