Class: Moneta::Adapters::GDBM

Inherits:
Object
  • Object
show all
Includes:
CreateSupport, DBMAdapter, Defaults, EachKeySupport, IncrementSupport
Defined in:
lib/moneta/adapters/gdbm.rb

Overview

GDBM backend

Instance Attribute Summary

Attributes included from HashAdapter

#backend

Instance Method Summary collapse

Methods included from EachKeySupport

#each_key, included

Methods included from CreateSupport

#create, included

Methods included from IncrementSupport

included, #increment

Methods included from DBMAdapter

#close, #merge!

Methods included from HashAdapter

#clear, #delete, #fetch_values, #key?, #load, #merge!, #slice, #store, #values_at

Methods included from Defaults

#[], #[]=, #close, #create, #decrement, #each_key, #features, #fetch, #fetch_values, included, #increment, #key?, #merge!, #slice, #supports?, #update, #values_at

Methods included from OptionSupport

#expires, #prefix, #raw, #with

Constructor Details

#initialize(options = {}) ⇒ GDBM

Returns a new instance of GDBM

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :file (String)

    Database file

  • :backend (::GDBM)

    Use existing backend instance



17
18
19
20
21
22
23
# File 'lib/moneta/adapters/gdbm.rb', line 17

def initialize(options = {})
  @backend = options[:backend] ||
    begin
      raise ArgumentError, 'Option :file is required' unless options[:file]
      ::GDBM.new(options[:file])
    end
end