phonelib 0.8.5 → 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: c3f8e7fe24a6bafb1bbb3f6d1b816b119ac44843910766135e07ceca70113dba
4
- data.tar.gz: d9b3ae4e1d6c4831851e1772bdea89bc7cd546f0968e6fcb44e194fa73009a16
3
+ metadata.gz: 85cd4f24c68ac6068113a435814644b935665fbb93e7272ac7ca8ea76ae15a71
4
+ data.tar.gz: 68985385d3e308bb5d1506b6ef4facd97792e9fea2018dd74802d5f2e2f9b15c
5
5
  SHA512:
6
- metadata.gz: e67a1c2d70a2d7f415677f8e5dc606cb295152fc0dc1429ea2526086d7465c4dbf7e37ebdae10f27e2683aea5ee1846099353b089f720b247857870f467c2ffa
7
- data.tar.gz: 67292dc389d84851d3ee89661a9f93e6d90514af538efebab4b9cae5c1789a9c44e0b797eec45102f4b6f8ecf5a1acfe4ee549cc0422c5d9758cebd3f30ee7a7
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.5'
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.5
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-11-05 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