GithubHelp home page GithubHelp logo

isabella232 / gdbm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruby/gdbm

0.0 0.0 0.0 156 KB

Ruby extension for GNU dbm.

License: BSD 2-Clause "Simplified" License

Ruby 47.99% C 51.80% Shell 0.21%

gdbm's Introduction

GDBM

GNU dbm is a library for simple databases. A database is a file that stores key-value pairs. Gdbm allows the user to store, retrieve, and delete data by key. It furthermore allows a non-sorted traversal of all key-value pairs. A gdbm database thus provides the same functionality as a hash. As with objects of the Hash class, elements can be accessed with []. Furthermore, GDBM mixes in the Enumerable module, thus providing convenient methods such as #find, #collect, #map, etc.

A process is allowed to open several different databases at the same time. A process can open a database as a "reader" or a "writer". Whereas a reader has only read-access to the database, a writer has read- and write-access. A database can be accessed either by any number of readers or by exactly one writer at the same time.

Installation

Add this line to your application's Gemfile:

gem 'gdbm'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gdbm

Usage

  1. Opening/creating a database, and filling it with some entries: require 'gdbm'
gdbm = GDBM.new("fruitstore.db")
gdbm["ananas"]    = "3"
gdbm["banana"]    = "8"
gdbm["cranberry"] = "4909"
gdbm.close
  1. Reading out a database:
require 'gdbm'

gdbm = GDBM.new("fruitstore.db")
gdbm.each_pair do |key, value|
  print "#{key}: #{value}\n"
end
gdbm.close

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/gdbm.

License

The gem is available as open source under the terms of the 2-Clause BSD License.

gdbm's People

Contributors

akr avatar eban avatar hsbt avatar jeremyevans avatar knu avatar ko1 avatar mame avatar nobu avatar nurse avatar shirosaki avatar shugo avatar unak avatar witkwski avatar znz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.