Sha256: ac3f81c7c4d988c7d2f16b65431c85a23678cfff003652e9bff9aca28fea92d7

Contents?: true

Size: 370 Bytes

Versions: 1

Compression:

Stored size: 370 Bytes

Contents

require 'sdbm'

module Cubbyhole
  class SDBM
    extend Forwardable
    def_delegators :@sdbm, :keys, :delete, :clear

    def initialize(name)
      @sdbm = ::SDBM.new("cubbyhole.#{name}.sdbm")
    end

    def [](key)
      if str = @sdbm[key]
        Marshal.load(str)
      end
    end

    def []=(key, val)
      @sdbm[key] = Marshal.dump(val)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cubbyhole-0.2.0 lib/cubbyhole/sdbm.rb