active_validation 4.0.8 → 4.0.9

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
  SHA1:
3
- metadata.gz: 91f5bc2ffa4caf18e05f39ecd8f8deda3937091b
4
- data.tar.gz: ff902a17fd63dddf75c4a687f809867d9ac68ead
3
+ metadata.gz: 16f9dcec3331a8ad7b8462c54a74bb9aefcd80a1
4
+ data.tar.gz: acecbc4a4e4407e53636e599885ff83df9173882
5
5
  SHA512:
6
- metadata.gz: a9cccc0c94152f26ab7c24d75e48ef30f86ae02c0e8862a7e4c0f1246a53c9d7c02bc47c494161f8375d7cf58bff670ce4adecb7579f9576679456434d8122ab
7
- data.tar.gz: 68fd81d6cd9c426c57e14db746ac570af7bd45b07f4d91c749b20229fb7dad2eed704fd0792f0f5fffc7094069ab017dae6923e5302dd140edf4f9b013ae80a3
6
+ metadata.gz: e6b5932e0dbae78743ad2ef32c65a7870d34aed5557ab0384b4d7c49676ed066e3eb689fa56a7e66d1e530d93e394b6916b4976f33ab8a5b3f043153b7ae4c93
7
+ data.tar.gz: f30c40d9e4267d2d674ff0f72bb19965bcc70300d28cb8d5ba8244728eb52eeb416837f337277d6d0590086e653fccd4617b618f886c9c32d27e62c9467d1a51
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
  DisplayStyleGuide: true
4
- TargetRubyVersion: 2.3
4
+ TargetRubyVersion: 2.4
5
5
  Exclude:
6
6
  - 'spec/**/**/*'
7
7
  Layout/ClosingParenthesisIndentation:
@@ -10,7 +10,7 @@ class CusipValidator < ActiveModel::EachValidator
10
10
 
11
11
  # rubocop:disable Lint/UselessAssignment
12
12
  def valid_checksum?(value)
13
- digits = value.chars.map { |chr| chr =~ /[A-Z]/ ? (chr.ord - 55) : chr.to_i }
13
+ digits = value.chars.map { |chr| /[A-Z]/.match?(chr) ? (chr.ord - 55) : chr.to_i }
14
14
  even_values = digits.values_at(* digits.each_index.select(&:even?))
15
15
  odd_values = digits.values_at(* digits.each_index.select(&:odd?))
16
16
  values = odd_values.map { |int| int * 2 }.zip(even_values).flatten
@@ -10,7 +10,7 @@ class IsinValidator < ActiveModel::EachValidator
10
10
 
11
11
  def valid_checksum?(value)
12
12
  characters = value.chars
13
- digits = characters.map { |chr| chr =~ /[A-Z]/ ? (chr.ord - 55) : chr.to_i }
13
+ digits = characters.map { |chr| /[A-Z]/.match?(chr) ? (chr.ord - 55) : chr.to_i }
14
14
  even_values = digits.values_at(*digits.each_index.select(&:even?))
15
15
  odd_values = digits.values_at(*digits.each_index.select(&:odd?))
16
16
 
@@ -11,7 +11,7 @@ class SedolValidator < ActiveModel::EachValidator
11
11
  private
12
12
 
13
13
  def valid_checksum?(value)
14
- digits = value.chars.map { |dgt| dgt =~ /[A-Z]/ ? (dgt.ord - 55) : dgt.to_i }
14
+ digits = value.chars.map { |dgt| /[A-Z]/.match?(dgt) ? (dgt.ord - 55) : dgt.to_i }
15
15
 
16
16
  total = 0
17
17
  digits.each_with_index { |dgt, idx| total += (WEIGHTS[idx] * dgt) }
@@ -81,7 +81,7 @@ class TrackingNumberValidator < ActiveModel::EachValidator
81
81
  end
82
82
 
83
83
  def valid_fedex_smart_post_checksum?(value)
84
- value = "92#{value}" unless value =~ /^92/
84
+ value = "92#{value}" unless /^92/.match?(value)
85
85
  return(false) unless value.size == 22
86
86
 
87
87
  pattern = CARRIERS_AND_SERVICES[:fedex][:smart_post]
@@ -177,7 +177,7 @@ class TrackingNumberValidator < ActiveModel::EachValidator
177
177
  end
178
178
 
179
179
  def valid_usps_usps91_checksum?(value)
180
- value = "91#{value}" unless value =~ /^(420\d{5})?9[1-5]/
180
+ value = "91#{value}" unless /^(420\d{5})?9[1-5]/.match?(value)
181
181
  return(false) unless value.size == 22
182
182
 
183
183
  pattern = CARRIERS_AND_SERVICES[:usps][:usps91]
@@ -1,3 +1,3 @@
1
1
  module ActiveValidation
2
- VERSION = '4.0.8'.freeze
2
+ VERSION = '4.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez