class MaxMind::DB::Metadata
Metadata
holds metadata about a MaxMind DB file. See maxmind.github.io/MaxMind-DB/#database-metadata for the specification.
Attributes
The major version number of the binary format used when creating the database.
@return [Integer]
The minor version number of the binary format used when creating the database.
@return [Integer]
The Unix epoch for the build time of the database.
@return [Integer]
A string identifying the database type. e.g., “GeoIP2-City”.
@return [String]
A hash from locales to text descriptions of the database.
@return [Hash<String, String>]
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.
@return [Integer]
An array of locale codes supported by the database.
@return [Array<String>]
The number of nodes in the database.
@return [Integer]
The bit size of a record in the search tree.
@return [Integer]
Public Class Methods
m
is a hash representing the metadata map.
@!visibility private
# File lib/maxmind/db/metadata.rb, line 62 def initialize(map) @node_count = map['node_count'] @record_size = map['record_size'] @ip_version = map['ip_version'] @database_type = map['database_type'] @languages = map['languages'] @binary_format_major_version = map['binary_format_major_version'] @binary_format_minor_version = map['binary_format_minor_version'] @build_epoch = map['build_epoch'] @description = map['description'] end
Public Instance Methods
The size of a node in bytes.
@return [Integer]
# File lib/maxmind/db/metadata.rb, line 77 def node_byte_size @record_size / 4 end
The size of the search tree in bytes.
@return [Integer]
# File lib/maxmind/db/metadata.rb, line 84 def search_tree_size @node_count * node_byte_size end