taiwan_validator 1.2.0 → 1.3.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 +4 -4
- data/README.md +2 -0
- data/lib/address_validator.rb +0 -1
- data/lib/phone_number_validator.rb +13 -0
- data/lib/taiwan_validator/version.rb +1 -1
- data/lib/taiwan_validator.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 757740928b53776a01be1ebf2fdf6e7214b374b7
|
4
|
+
data.tar.gz: 9cfe758db6cba0e2d2341a8a39bd1b2693f8e127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bccb74f30d14c162d0d1a2bba16d57b96706f8ce04addbf45a94b9ddefd90effcc37cf3daaaf8c523a0e2b328929fd26a988ab09c38b0de69fd06332c4a71508
|
7
|
+
data.tar.gz: 642573c17c41a9243b7aa68e44a401e1376e1d853f6c6de060c947820459cf5e1d5329a8b4150298424c48dc420da41693660883a51004ab03bec8499c9d228b
|
data/README.md
CHANGED
data/lib/address_validator.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
class PhoneNumberValidator < ActiveModel::EachValidator
|
2
|
+
class << self
|
3
|
+
def valid?(phone_number)
|
4
|
+
phone_number.gsub(/[\+\-\s]/, "") =~ /\A(886|0)[2-9]([0-9]{6,8})\z/
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def validate_each(record, attribute, value)
|
9
|
+
unless self.class.valid?(value)
|
10
|
+
record.errors.add(attribute, options[:message] || :invalid)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/taiwan_validator.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taiwan_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Yun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- bin/setup
|
100
100
|
- lib/address_validator.rb
|
101
101
|
- lib/id_validator.rb
|
102
|
+
- lib/phone_number_validator.rb
|
102
103
|
- lib/taiwan_validator.rb
|
103
104
|
- lib/taiwan_validator/version.rb
|
104
105
|
- lib/ubn_validator.rb
|