Sha256: 6b5667e07ce3553fee0a5c169300e4a1699eec221adff107a80a4a09d2e3dd29
Contents?: true
Size: 693 Bytes
Versions: 13
Compression:
Stored size: 693 Bytes
Contents
module Adhoq module Storage class OnTheFly PREFIX = 'memory://adhoq-on-the-fly' attr_reader :identifier, :reports def initialize(id_base = Process.pid) @identifier = "#{PREFIX}-#{id_base}" @reports = {} end def store(suffix = nil, seed = Time.now, &block) Adhoq::Storage.with_new_identifier(suffix, seed) do |identifier| @reports[identifier] = yield.tap(&:rewind) end end def direct_download? false end def get(identifier) if item = @reports.delete(identifier) item.read.tap { item.close } else nil end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems