phony 2.20.14 → 2.21.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.textile +1 -1
 - data/lib/phony/config.rb +25 -26
 - data/lib/phony/countries/argentina.rb +311 -314
 - data/lib/phony/countries/austria.rb +71 -72
 - data/lib/phony/countries/bangladesh.rb +27 -28
 - data/lib/phony/countries/belarus.rb +110 -111
 - data/lib/phony/countries/brazil.rb +92 -92
 - data/lib/phony/countries/cambodia.rb +9 -9
 - data/lib/phony/countries/china.rb +22 -21
 - data/lib/phony/countries/croatia.rb +6 -5
 - data/lib/phony/countries/georgia.rb +84 -84
 - data/lib/phony/countries/germany.rb +4067 -4068
 - data/lib/phony/countries/guinea.rb +8 -8
 - data/lib/phony/countries/india.rb +31 -34
 - data/lib/phony/countries/indonesia.rb +57 -46
 - data/lib/phony/countries/ireland.rb +4 -5
 - data/lib/phony/countries/italy.rb +54 -53
 - data/lib/phony/countries/japan.rb +456 -456
 - data/lib/phony/countries/kyrgyzstan.rb +109 -109
 - data/lib/phony/countries/latvia.rb +34 -34
 - data/lib/phony/countries/libya.rb +106 -106
 - data/lib/phony/countries/malaysia.rb +12 -12
 - data/lib/phony/countries/moldova.rb +42 -42
 - data/lib/phony/countries/montenegro.rb +24 -20
 - data/lib/phony/countries/myanmar.rb +39 -39
 - data/lib/phony/countries/namibia.rb +35 -29
 - data/lib/phony/countries/nepal.rb +60 -62
 - data/lib/phony/countries/netherlands.rb +13 -13
 - data/lib/phony/countries/pakistan.rb +134 -110
 - data/lib/phony/countries/paraguay.rb +135 -135
 - data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
 - data/lib/phony/countries/saudi_arabia.rb +5 -5
 - data/lib/phony/countries/serbia.rb +47 -39
 - data/lib/phony/countries/somalia.rb +18 -18
 - data/lib/phony/countries/south_korea.rb +16 -13
 - data/lib/phony/countries/sweden.rb +28 -28
 - data/lib/phony/countries/taiwan.rb +20 -19
 - data/lib/phony/countries/tajikistan.rb +70 -70
 - data/lib/phony/countries/turkmenistan.rb +65 -65
 - data/lib/phony/countries/ukraine.rb +607 -607
 - data/lib/phony/countries/united_kingdom.rb +66 -66
 - data/lib/phony/countries/uruguay.rb +40 -41
 - data/lib/phony/countries/vietnam.rb +18 -17
 - data/lib/phony/countries/zimbabwe.rb +31 -31
 - data/lib/phony/countries.rb +440 -443
 - data/lib/phony/country.rb +42 -44
 - data/lib/phony/country_codes.rb +66 -60
 - data/lib/phony/dsl.rb +23 -26
 - data/lib/phony/local_splitters/fixed.rb +20 -29
 - data/lib/phony/local_splitters/regex.rb +28 -31
 - data/lib/phony/national_code.rb +7 -10
 - data/lib/phony/national_splitters/default.rb +9 -11
 - data/lib/phony/national_splitters/dsl.rb +8 -18
 - data/lib/phony/national_splitters/fixed.rb +11 -14
 - data/lib/phony/national_splitters/none.rb +7 -11
 - data/lib/phony/national_splitters/regex.rb +13 -17
 - data/lib/phony/national_splitters/variable.rb +36 -38
 - data/lib/phony/trunk_code.rb +16 -18
 - data/lib/phony/vanity.rb +12 -13
 - data/lib/phony.rb +84 -84
 - metadata +5 -39
 - data/spec/functional/config_spec.rb +0 -44
 - data/spec/functional/plausibility_spec.rb +0 -689
 - data/spec/lib/phony/countries_spec.rb +0 -1460
 - data/spec/lib/phony/country_codes_spec.rb +0 -227
 - data/spec/lib/phony/country_spec.rb +0 -104
 - data/spec/lib/phony/dsl_spec.rb +0 -28
 - data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
 - data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
 - data/spec/lib/phony/national_code_spec.rb +0 -61
 - data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
 - data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
 - data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
 - data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
 - data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
 - data/spec/lib/phony/trunk_code_spec.rb +0 -85
 - data/spec/lib/phony/vanity_spec.rb +0 -30
 - data/spec/lib/phony_spec.rb +0 -70
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4ff2cd9c33f893f770fd66ba1665ace7827d0d30bb21f1f0a46ace070f9e683b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 34fed8e28246ab7db2b348e9bb6a46956e0eb366ef94bdfa9f0f3798b7c87cc5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d0ce05e1ed6fac6fc0a23b57549b9ffd71bf45f2b258e606348e1f2572afdcaa00d6c2da5923a4568f3b02ad09b5390e23a571a0e8182df79927b4737245b081
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2f0b899f0acba7142a4c68de1ddf00a66b2f8a7f2996bc22d981695dda9c0dcdb823c98c40d76e9cb0845f77657327b65a05aa7ee774cef1438f9d4ead6c500f
         
     | 
    
        data/README.textile
    CHANGED
    
    | 
         @@ -108,7 +108,7 @@ Mildly unmaintained list: Abhas, Afghan, Algerian, Argentina, Austrian, Australi 
     | 
|
| 
       108 
108 
     | 
    
         | 
| 
       109 
109 
     | 
    
         
             
            h2. Proud Sponsors
         
     | 
| 
       110 
110 
     | 
    
         | 
| 
       111 
     | 
    
         
            -
            * Renuo AG (July  
     | 
| 
      
 111 
     | 
    
         
            +
            * Renuo AG (July 2022 – January 2025): "Github":https://github.com/renuo, "Homepage":https://www.renuo.ch. Much appreciated!
         
     | 
| 
       112 
112 
     | 
    
         | 
| 
       113 
113 
     | 
    
         
             
            h2. License
         
     | 
| 
       114 
114 
     | 
    
         | 
    
        data/lib/phony/config.rb
    CHANGED
    
    | 
         @@ -1,53 +1,53 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Phony
         
     | 
| 
       4 
     | 
    
         
            -
              
         
     | 
| 
       5 
4 
     | 
    
         
             
              # Add config.
         
     | 
| 
       6 
5 
     | 
    
         
             
              class << self
         
     | 
| 
       7 
6 
     | 
    
         
             
                attr_writer :config
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       9 
8 
     | 
    
         
             
                def config
         
     | 
| 
       10 
9 
     | 
    
         
             
                  # Default config includes all CCs.
         
     | 
| 
       11 
10 
     | 
    
         
             
                  @config ||= Config.new([], [])
         
     | 
| 
       12 
11 
     | 
    
         
             
                end
         
     | 
| 
       13 
12 
     | 
    
         
             
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       15 
14 
     | 
    
         
             
              # The Config class is only used to configure Phony and to load specific
         
     | 
| 
       16 
15 
     | 
    
         
             
              # subsets of CCs.
         
     | 
| 
       17 
16 
     | 
    
         
             
              #
         
     | 
| 
       18 
17 
     | 
    
         
             
              class Config
         
     | 
| 
       19 
     | 
    
         
            -
                
         
     | 
| 
       20 
18 
     | 
    
         
             
                attr_reader :included_ccs, :excluded_ccs
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                def initialize 
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def initialize(included_ccs, excluded_ccs)
         
     | 
| 
       23 
21 
     | 
    
         
             
                  @included_ccs = included_ccs || []
         
     | 
| 
       24 
22 
     | 
    
         
             
                  @excluded_ccs = excluded_ccs || []
         
     | 
| 
       25 
23 
     | 
    
         
             
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                def load? 
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def load?(cc)
         
     | 
| 
       28 
26 
     | 
    
         
             
                  return false if has_excluded? && excluded_ccs.include?(cc)
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       30 
28 
     | 
    
         
             
                  if has_included?
         
     | 
| 
       31 
29 
     | 
    
         
             
                    # We have to check the included_ccs, otherwise false.
         
     | 
| 
       32 
30 
     | 
    
         
             
                    return true if included_ccs.include?(cc)
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       34 
32 
     | 
    
         
             
                    false
         
     | 
| 
       35 
33 
     | 
    
         
             
                  else
         
     | 
| 
       36 
34 
     | 
    
         
             
                    # It's not in excluded and no included was given.
         
     | 
| 
       37 
35 
     | 
    
         
             
                    true
         
     | 
| 
       38 
36 
     | 
    
         
             
                  end
         
     | 
| 
       39 
37 
     | 
    
         
             
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       40 
39 
     | 
    
         
             
                def has_included?
         
     | 
| 
       41 
40 
     | 
    
         
             
                  !included_ccs.empty?
         
     | 
| 
       42 
41 
     | 
    
         
             
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       43 
43 
     | 
    
         
             
                def has_excluded?
         
     | 
| 
       44 
44 
     | 
    
         
             
                  !excluded_ccs.empty?
         
     | 
| 
       45 
45 
     | 
    
         
             
                end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       47 
47 
     | 
    
         
             
                # Use as follows:
         
     | 
| 
       48 
48 
     | 
    
         
             
                #
         
     | 
| 
       49 
49 
     | 
    
         
             
                #   require 'phony/config'
         
     | 
| 
       50 
     | 
    
         
            -
                # 
     | 
| 
      
 50 
     | 
    
         
            +
                #
         
     | 
| 
       51 
51 
     | 
    
         
             
                #   # Load only these:
         
     | 
| 
       52 
52 
     | 
    
         
             
                #   Phony::Config.load(only: ['41', '44'])
         
     | 
| 
       53 
53 
     | 
    
         
             
                #   # or all except these:
         
     | 
| 
         @@ -61,31 +61,30 @@ module Phony 
     | 
|
| 
       61 
61 
     | 
    
         
             
                  # Extract options.
         
     | 
| 
       62 
62 
     | 
    
         
             
                  last = options.last
         
     | 
| 
       63 
63 
     | 
    
         
             
                  only, except = if last.respond_to?(:to_hash)
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
                                   # We have the explicit form.
         
     | 
| 
      
 65 
     | 
    
         
            +
                                   [last[:only], last[:except]]
         
     | 
| 
      
 66 
     | 
    
         
            +
                                 elsif options.respond_to?(:to_ary)
         
     | 
| 
      
 67 
     | 
    
         
            +
                                   # We have the convenience short forms.
         
     | 
| 
      
 68 
     | 
    
         
            +
                                   [options, []]
         
     | 
| 
      
 69 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
       71 
71 
     | 
    
         
             
                  # Set defaults.
         
     | 
| 
       72 
72 
     | 
    
         
             
                  only, except = [only || [], except || []]
         
     | 
| 
       73 
73 
     | 
    
         
             
                  # Convert to expected format if possible.
         
     | 
| 
       74 
74 
     | 
    
         
             
                  only, except = [only.map(&:to_s), except.map(&:to_s)]
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       76 
76 
     | 
    
         
             
                  # Check params.
         
     | 
| 
       77 
77 
     | 
    
         
             
                  raise "Params given to Phony::Config.load must be Array-like. The one given was: #{only}" unless only.respond_to?(:to_ary)
         
     | 
| 
       78 
78 
     | 
    
         
             
                  raise "Params given to Phony::Config.load must be Array-like. The one given was: #{except}" unless except.respond_to?(:to_ary)
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       80 
80 
     | 
    
         
             
                  # Configure Phony.
         
     | 
| 
       81 
81 
     | 
    
         
             
                  Phony.config = new(only, except)
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
       83 
83 
     | 
    
         
             
                  # Load phony.
         
     | 
| 
       84 
     | 
    
         
            -
                  Kernel.load File.expand_path(' 
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 84 
     | 
    
         
            +
                  Kernel.load File.expand_path('../phony.rb', __dir__)
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       86 
86 
     | 
    
         
             
                  # Return the stored config data.
         
     | 
| 
       87 
87 
     | 
    
         
             
                  Phony.config
         
     | 
| 
       88 
88 
     | 
    
         
             
                end
         
     | 
| 
       89 
     | 
    
         
            -
                
         
     | 
| 
       90 
89 
     | 
    
         
             
              end
         
     | 
| 
       91 
     | 
    
         
            -
            end
         
     | 
| 
      
 90 
     | 
    
         
            +
            end
         
     |