method

new

Importance_2
Ruby latest stable (v2_5_5) - 0 notes - Class: GDBM
new(p1, p2 = v2, p3 = v3) public

Creates a new GDBM instance by opening a gdbm file named filename. If the file does not exist, a new file with file mode mode will be created. flags may be one of the following:

  • READER - open as a reader

  • WRITER - open as a writer

  • WRCREAT - open as a writer; if the database does not exist, create a new one

  • NEWDB - open as a writer; overwrite any existing databases

The values WRITER, WRCREAT and NEWDB may be combined with the following values by bitwise or:

  • SYNC - cause all database operations to be synchronized to the disk

  • NOLOCK - do not lock the database file

If no flags are specified, the GDBM object will try to open the database file as a writer and will create it if it does not already exist (cf. flag WRCREAT). If this fails (for instance, if another process has already opened the database as a reader), it will try to open the database file as a reader (cf. flag READER).

Show source
Register or log in to add new notes.