phonelib 0.8.4 → 0.8.6

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
  SHA256:
3
- metadata.gz: cc68ad6683a9dbc13f88b825e589c1836a31e83b8f67c6e71d54afac44d0fceb
4
- data.tar.gz: 39ed9dfdc4bf02a8850c18068be4e24407141734718a71e8fa4779f0f1c4ff17
3
+ metadata.gz: 85cd4f24c68ac6068113a435814644b935665fbb93e7272ac7ca8ea76ae15a71
4
+ data.tar.gz: 68985385d3e308bb5d1506b6ef4facd97792e9fea2018dd74802d5f2e2f9b15c
5
5
  SHA512:
6
- metadata.gz: 21e94b4cd849e0116189ef7b232dd2d6949b02b9e6e295dfe463272b035669a062d90902e7f4aa6c98001c05dfa2c803f9e83320fe1b32e16f654d88305c62ca
7
- data.tar.gz: f05c697263e31b17a6946ac9fda9c52780fa2aaef23b4031ba7eced4b34b5d576a581dbeacda334d962cb64cd46edebc1aa1c0e5fbcdf9661ccc7d0f28448dbd
6
+ metadata.gz: a54324348a4569f95986931c73eca14c528cd36a1842f35871658caddf9ef233144be3a8eceab34f554cf43de78d729b0dcd222c675bb64dfda0913cf84b2881
7
+ data.tar.gz: d10d62611b2876cd3e409c6d03474904359b7facf30e016e425fd5b116bb6c8cf4af619e47260c74aa612078a704cf93c18cc18ed0f8c54f296e4b6d0e7bb187
Binary file
data/data/phone_data.dat CHANGED
Binary file
data/lib/phonelib/core.rb CHANGED
@@ -4,6 +4,13 @@ module Phonelib
4
4
  # @private variable will include hash with data for validation
5
5
  @@phone_data = nil
6
6
 
7
+ # eagerly initialize the gem, loads data into memory. not required, initialization is done lazily otherwise, but
8
+ # may be desirable in production enviroments to avoid initialization time on first use.
9
+ def eager_load!
10
+ phone_data
11
+ phone_ext_data
12
+ end
13
+
7
14
  # getter for phone data for other modules of gem, can be used outside
8
15
  # @return [Hash] all data for phone parsing
9
16
  def phone_data
@@ -197,7 +197,7 @@ module Phonelib
197
197
 
198
198
  require 'open-uri'
199
199
  require 'csv'
200
- io = open('http://api.geonames.org/countryInfoCSV?username=demo&style=full')
200
+ io = URI.open('http://download.geonames.org/export/dump/countryInfo.txt')
201
201
  csv = CSV.new(io, {col_sep: "\t"})
202
202
  csv.each do |row|
203
203
  next if row[0].nil? || row[0].start_with?('#') || row[0].empty? || row[0].size != 2
@@ -1,4 +1,4 @@
1
1
  module Phonelib
2
2
  # @private
3
- VERSION = '0.8.4'
3
+ VERSION = '0.8.6'
4
4
  end
data/lib/phonelib.rb CHANGED
@@ -17,4 +17,12 @@ if defined?(ActiveModel) || defined?(Rails)
17
17
  else
18
18
  autoload :PhoneValidator, 'validators/phone_validator'
19
19
  end
20
+
21
+ if defined?(Rails)
22
+ class Phonelib::Railtie < Rails::Railtie
23
+ initializer 'phonelib' do |app|
24
+ app.config.eager_load_namespaces << Phonelib
25
+ end
26
+ end
27
+ end
20
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Senderovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-26 00:00:00.000000000 Z
11
+ date: 2023-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.13.0
33
+ version: '1.15'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.13.0
40
+ version: '1.15'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.0
75
+ version: 1.0.9
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0
82
+ version: 1.0.9
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.0.9
200
+ rubygems_version: 3.1.4
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Gem validates phone numbers with Google libphonenumber database