Name

DBM — DBM class

Synopsis

DBM implements a database with the same interface as a hash. Keys and values are limited to strings. Uses ndbm library included in operating systems.

Required Library

require ‘dbm’

Included Module

Enumerable

Class Methods

DBM::open(path[, mode=0666])
DBM::new(path[, mode=0666])

Opens a new DBM database. Access rights to the database are specified in mode as an integer.

Instance Methods

The DBM class has all the methods of the Hash class except for default, default=, dup, and rehash. DBM also has the close method, which isn’t in Hash.

d.close

Closes DBM database

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.