phony 2.12.0 → 2.12.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
  SHA1:
3
- metadata.gz: 9ed5de3b041644628bf1c702210e88291f7bbb20
4
- data.tar.gz: 56b7326025d25289a02bc7feb0847be683cace10
3
+ metadata.gz: df08cdef9c3c23e6aaa8895f501bab5c7257e174
4
+ data.tar.gz: 8ae9fa56084ca73ccf1c2320429cd057c83fe4d1
5
5
  SHA512:
6
- metadata.gz: 6dbf4c9482be5886e586fc60e6258597f1942c06b062f7d9d4b1c5e54e1d38d5e67f66557c943aac08b60aea72824bc1f3addfa9f10027d9a411ae58fc330351
7
- data.tar.gz: 7333d68cc3b7b15c143a18c85b54ef44ed6c034aab3328a7582aea4352d4020e1d8aa54a3237421233f6c0a80863cd62ec10c5d560a072313de4c8ffa9682b4d
6
+ metadata.gz: 3b4d98a8fec4023334c3f2f91528005db4e321dbd743fafa7b3666a4685966d03859700ee7123a7f16842d6a844096194df31ce3304291f1bc922f6effbd47f8
7
+ data.tar.gz: 6f3921fabdc4294cd8479673bae46d3ef2c6fbd6304f3f5c705874694a63e3d71532d45fe4f0848009e7d485be5f570e3595fcaa686bd76e5ab9f16aff74f0d4
@@ -35,7 +35,7 @@ Phony.define do
35
35
  # The US has a delimiter between NDC and local number.
36
36
  trunk('1%s', normalize: true) | # http://en.wikipedia.org/wiki/Trunk_prefix
37
37
  fixed(3) >> split(3,4),
38
- :invalid_ndcs => ['911']
38
+ :invalid_ndcs => /[0-2]\d{2}|[3-9]11/
39
39
 
40
40
  # Kazakhstan (Republic of) & Russsian Federation.
41
41
  # also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
@@ -26,7 +26,7 @@ module Phony
26
26
  #
27
27
  def with cc, options = {}
28
28
  @cc = cc
29
- @invalid_ndcs = options[:invalid_ndcs] || []
29
+ @invalid_ndcs = options[:invalid_ndcs]
30
30
  @format = options[:format]
31
31
  @space = options[:space]
32
32
  @local_space = options[:local_space]
@@ -97,7 +97,7 @@ module Phony
97
97
  #
98
98
  return false if ndc.nil?
99
99
  return false if ndc && ndc.empty?
100
- return false if @invalid_ndcs.include? ndc # TODO Refactor.
100
+ return false if @invalid_ndcs && @invalid_ndcs === ndc
101
101
 
102
102
  # # A valid range for the rest is 0 or 3+ total digits.
103
103
  # #
@@ -519,6 +519,8 @@ describe 'plausibility' do
519
519
  Phony.plausible?('1-800-692-7753').should be_true
520
520
  Phony.plausible?('1-911').should be_false
521
521
  Phony.plausible?('1-911-123-1234').should be_false
522
+ Phony.plausible?('1-411-123-1234').should be_false
523
+ Phony.plausible?('1-040-123-1234').should be_false
522
524
  Phony.plausible?('143466677777').should be_false # too long
523
525
  Phony.plausible?('143466677').should be_false # too short
524
526
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-05 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Fast international phone number (E164 standard) normalizing, splitting
14
14
  and formatting. Lots of formatting options: International (+.., 00..), national