Sha256: a7ca77f5365a6969433b46c7eea77f8e04295ab81b1f567e5bb877cfac4b762b

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

module ArubaDoubles
  class History

    include Enumerable

    def initialize(filename)
      @store = PStore.new(filename)
    end

    def <<(args)
      @store.transaction do
        @store[:history] ||= []
        @store[:history] << args
      end
    end

    def clear
      @store.transaction do
        @store[:history] = []
      end
    end

    def each
      entries.each { |e| yield(e) }
    end

  private

    def entries
      @store.transaction(readonly=true) do
        @store[:history] || []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aruba-doubles-1.2.0 lib/aruba-doubles/history.rb