Class: MaxMind::DB::Metadata
- Inherits:
-
Object
- Object
- MaxMind::DB::Metadata
- Defined in:
- lib/maxmind/db/metadata.rb
Overview
Metadata holds metadata about a MaxMind DB file. See maxmind.github.io/MaxMind-DB/#database-metadata for the specification.
Instance Attribute Summary collapse
-
#binary_format_major_version ⇒ Integer
readonly
The major version number of the binary format used when creating the database.
-
#binary_format_minor_version ⇒ Integer
readonly
The minor version number of the binary format used when creating the database.
-
#build_epoch ⇒ Integer
readonly
The Unix epoch for the build time of the database.
-
#database_type ⇒ String
readonly
A string identifying the database type.
-
#description ⇒ Hash<String, String>
readonly
A hash from locales to text descriptions of the database.
-
#ip_version ⇒ Integer
readonly
The IP version of the data in the database.
-
#languages ⇒ Array<String>
readonly
An array of locale codes supported by the database.
-
#node_count ⇒ Integer
readonly
The number of nodes in the database.
-
#record_size ⇒ Integer
readonly
The bit size of a record in the search tree.
Instance Method Summary collapse
-
#node_byte_size ⇒ Integer
The size of a node in bytes.
-
#search_tree_size ⇒ Integer
The size of the search tree in bytes.
Instance Attribute Details
#binary_format_major_version ⇒ Integer (readonly)
The major version number of the binary format used when creating the database.
41 42 43 |
# File 'lib/maxmind/db/metadata.rb', line 41 def binary_format_major_version @binary_format_major_version end |
#binary_format_minor_version ⇒ Integer (readonly)
The minor version number of the binary format used when creating the database.
47 48 49 |
# File 'lib/maxmind/db/metadata.rb', line 47 def binary_format_minor_version @binary_format_minor_version end |
#build_epoch ⇒ Integer (readonly)
The Unix epoch for the build time of the database.
52 53 54 |
# File 'lib/maxmind/db/metadata.rb', line 52 def build_epoch @build_epoch end |
#database_type ⇒ String (readonly)
A string identifying the database type. e.g., “GeoIP2-City”.
30 31 32 |
# File 'lib/maxmind/db/metadata.rb', line 30 def database_type @database_type end |
#description ⇒ Hash<String, String> (readonly)
A hash from locales to text descriptions of the database.
57 58 59 |
# File 'lib/maxmind/db/metadata.rb', line 57 def description @description end |
#ip_version ⇒ Integer (readonly)
The IP version of the data in the database. A value of 4 means the database only supports IPv4. A database with a value of 6 may support both IPv4 and IPv6 lookups.
25 26 27 |
# File 'lib/maxmind/db/metadata.rb', line 25 def ip_version @ip_version end |
#languages ⇒ Array<String> (readonly)
An array of locale codes supported by the database.
35 36 37 |
# File 'lib/maxmind/db/metadata.rb', line 35 def languages @languages end |
#node_count ⇒ Integer (readonly)
The number of nodes in the database.
13 14 15 |
# File 'lib/maxmind/db/metadata.rb', line 13 def node_count @node_count end |
#record_size ⇒ Integer (readonly)
The bit size of a record in the search tree.
18 19 20 |
# File 'lib/maxmind/db/metadata.rb', line 18 def record_size @record_size end |
Instance Method Details
#node_byte_size ⇒ Integer
The size of a node in bytes.
77 78 79 |
# File 'lib/maxmind/db/metadata.rb', line 77 def node_byte_size @record_size / 4 end |
#search_tree_size ⇒ Integer
The size of the search tree in bytes.
84 85 86 |
# File 'lib/maxmind/db/metadata.rb', line 84 def search_tree_size @node_count * node_byte_size end |