Module: DbipUtil
Overview
DbipUtil includes DB-IP Lite databases and a simple interface to them, based on ‘maxmind-db` gem.
Constant Summary collapse
- DB_VERSION =
"2025.12"- VERSION =
"0.1.2.#{DB_VERSION}".freeze
Instance Method Summary collapse
Instance Method Details
#const_missing(const) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dbip_util.rb', line 18 def const_missing(const) case const when :Country const_set(const, open(:country)) when :City const_set(const, open(:city)) when :ASN const_set(const, open(:asn)) else super end end |
#open(db, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dbip_util.rb', line 10 def open(db, = {}) ensure_provisioned! = { mode: MaxMind::DB::MODE_FILE }.merge() fn = db_path(db) MaxMind::DB.new(fn, ) end |