maxminddb 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG.md +23 -0
- data/README.md +8 -0
- data/lib/maxminddb.rb +6 -4
- data/lib/maxminddb/version.rb +1 -1
- 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: 8baf986bd6ee8827d5dec1075ab871ed940a7450
|
4
|
+
data.tar.gz: d6c493bf9a2c759deaf221c7adde7092faf1ac02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5f7b6bc12aad94797fccd16c77a1b383e4c9b0502134e74429b2fafa1ea55db633d00ce7787f6c6f2039b845431f81e7c8441d22f3cb993e2291c63ff42bf6b
|
7
|
+
data.tar.gz: 88f840828b38a877fd346057f847e38bc04d6ad9977e61cd829f56cce781b40d4a05d0a3cded7451a27c45f38afd005c763887f2e4d3f7305e1f27039947dbbb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
### 0.1.13 (June 13, 2017)
|
4
|
+
|
5
|
+
- Expose database metadata #27
|
6
|
+
|
7
|
+
### 0.1.12 (January 11, 2017)
|
8
|
+
|
9
|
+
- Removed Fixnum and Bignum deprecation warnings (in ruby 2.4)
|
10
|
+
- Update Travis
|
11
|
+
- Fix failing test
|
12
|
+
|
13
|
+
### 0.1.11 (March 7, 2016)
|
14
|
+
|
15
|
+
- Fixed problem with 32bit record data
|
16
|
+
|
17
|
+
### 0.1.10 (February 25, 2016)
|
18
|
+
|
19
|
+
- Performance tweaks
|
20
|
+
|
21
|
+
***
|
22
|
+
|
23
|
+
*For older releases, see commit log.*
|
data/README.md
CHANGED
@@ -53,6 +53,14 @@ ret.country.name # => nil
|
|
53
53
|
ret.to_hash # => {}
|
54
54
|
```
|
55
55
|
|
56
|
+
It's also possible to access the database metadata.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
db = MaxMindDB.new('./GeoLite2-City.mmdb')
|
60
|
+
db.metadata['build_epoch'] # => 1493762948
|
61
|
+
db.metadata # => {"binary_format_major_version"=>2, "binary_format_minor_version"=>0, "build_epoch"=>1493762948, "database_type"=>"GeoLite2-City", "description"=>{"en"=>"GeoLite2 City database"}, "ip_version"=>6, "languages"=>["de", "en", "es", "fr", "ja", "pt-BR", "ru", "zh-CN"], "node_count"=>3678850, "record_size"=>28}
|
62
|
+
```
|
63
|
+
|
56
64
|
|
57
65
|
## Contributing
|
58
66
|
|
data/lib/maxminddb.rb
CHANGED
@@ -14,6 +14,8 @@ module MaxMindDB
|
|
14
14
|
SIZE_BASE_VALUES = [0, 29, 285, 65821]
|
15
15
|
POINTER_BASE_VALUES = [0, 0, 2048, 526336]
|
16
16
|
|
17
|
+
attr_reader :metadata
|
18
|
+
|
17
19
|
def initialize(path)
|
18
20
|
@path = path
|
19
21
|
@data = File.binread(path)
|
@@ -21,11 +23,11 @@ module MaxMindDB
|
|
21
23
|
pos = @data.rindex(METADATA_BEGIN_MARKER)
|
22
24
|
raise 'invalid file format' unless pos
|
23
25
|
pos += METADATA_BEGIN_MARKER.size
|
24
|
-
metadata = decode(pos, 0)[1]
|
26
|
+
@metadata = decode(pos, 0)[1]
|
25
27
|
|
26
|
-
@ip_version = metadata['ip_version']
|
27
|
-
@node_count = metadata['node_count']
|
28
|
-
@node_byte_size = metadata['record_size'] * 2 / 8
|
28
|
+
@ip_version = @metadata['ip_version']
|
29
|
+
@node_count = @metadata['node_count']
|
30
|
+
@node_byte_size = @metadata['record_size'] * 2 / 8
|
29
31
|
@search_tree_size = @node_count * @node_byte_size
|
30
32
|
end
|
31
33
|
|
data/lib/maxminddb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maxminddb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yhirose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
78
|
- ".travis.yml"
|
79
|
+
- CHANGELOG.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.md
|