number_plate_validator 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 01e3a23b8dd4a7917a5443533c4b76bb562ef35c
4
- data.tar.gz: a702e307049bc67f2a8730c8a7926b29b6a136db
3
+ metadata.gz: 7817ece4c99f143b32360eefae4294cdc75da963
4
+ data.tar.gz: c037f19a7daed0d99d98ae479e2da51294f21911
5
5
  SHA512:
6
- metadata.gz: acd486d64aaf5c578ce049c4db587d01d7707208696428283df18b9df5bbc68660ea315487d195545bdf4251eccff0a7f6bf1d70f4564c422ffc98b6c7b6447f
7
- data.tar.gz: 7e1dcdcbca8ce4fc1a63ee1909ac0d4a0bcbe7dfff29b996337fe1854ddb561fb14cf24cab005d05d7d48bfe1aba1817f44e13a1d0075b0b5304b60f12f96634
6
+ metadata.gz: 43b5c161270128cef30f8e3e41f8ad7076898815949b92e3d0c02cca88e6e38d1ed4280f1e8fb5eb7d9cbc33ecdad17d89c800b0afbd2a95dd27aee3612219fd
7
+ data.tar.gz: 8f3f9f188ec20dedfd7de89c69cdede3837320bef8992c43ef3ec7a3d64c889e2916ff946d6e2482ce42c9306ca344d860cee7cbd52d91f088bdc78a01b03f08
@@ -2,4 +2,6 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.3.0
5
+ - 2.4.0
6
+ - 2.5.0
5
7
  before_install: gem install bundler -v 1.13.1
@@ -12,11 +12,10 @@ module NumberPlateValidator
12
12
 
13
13
  class << self
14
14
  def validator(country_code)
15
- validator_class = eval "NumberPlateValidator::#{country_code}Validator"
15
+ validator_class = Object.const_get "NumberPlateValidator::#{country_code}Validator"
16
16
  validator = validator_class.new
17
17
  Validator.new(validator)
18
18
  end
19
19
  end
20
-
21
20
  end
22
21
 
@@ -1,9 +1,9 @@
1
- module ActiveModel
1
+ module ActiveModel
2
2
  module Validations
3
3
  class NumberPlateValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
5
  country = case(options[:country])
6
- when Proc
6
+ when Proc
7
7
  options[:country].call(record)
8
8
  when Symbol
9
9
  record.send(options[:country])
@@ -1,4 +1,4 @@
1
- module NumberPlateValidator
1
+ module NumberPlateValidator
2
2
  class MYValidator < CountryValidatorBase
3
3
 
4
4
  PATTERNS = [
@@ -22,7 +22,7 @@ module NumberPlateValidator
22
22
 
23
23
  def is_valid?(registration_number)
24
24
  return false unless super
25
- PATTERNS.any? { |pattern| @license =~ pattern }
25
+ PATTERNS.any? { |pattern| @license =~ pattern }
26
26
  end
27
27
 
28
28
  end
@@ -1,4 +1,4 @@
1
- module NumberPlateValidator
1
+ module NumberPlateValidator
2
2
  class SGValidator < CountryValidatorBase
3
3
  CHECK_SUM = { 0 => "A", 1 => "Z", 2 => "Y", 3 => "X", 4 => "U", 5 => "T", 6 => "S", 7 => "R", 8 => "P", 9 => "M", 10 => "L", 11 => "K", 12 => "J", 13 => "H", 14 => "G", 15 => "E", 16 => "D", 17 => "C", 18 => "B" }
4
4
  MULTIPLIER = [9, 4, 5, 4, 3, 2]
@@ -1,3 +1,3 @@
1
1
  module NumberPlateValidator
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: number_plate_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-29 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport