class Adhoq::Storage::OnTheFly
Constants
- PREFIX
Attributes
Public Class Methods
Source
# File lib/adhoq/storage/on_the_fly.rb, line 8 def initialize(id_base = Process.pid) @identifier = "#{PREFIX}-#{id_base}" @reports = {} end
Public Instance Methods
Source
# File lib/adhoq/storage/on_the_fly.rb, line 19 def direct_download? false end
Source
# File lib/adhoq/storage/on_the_fly.rb, line 23 def get(identifier) if item = @reports.delete(identifier) item.read.tap { item.close } else nil end end
Source
# File lib/adhoq/storage/on_the_fly.rb, line 13 def store(suffix = nil, seed = Time.now, &block) Adhoq::Storage.with_new_identifier(suffix, seed) do |identifier| @reports[identifier] = yield.tap(&:rewind) end end