Module: Adhoq::Storage

Defined in:
lib/adhoq/storage.rb,
lib/adhoq/storage/s3.rb,
lib/adhoq/storage/cache.rb,
lib/adhoq/storage/local_file.rb,
lib/adhoq/storage/on_the_fly.rb,
lib/adhoq/storage/fog_storage.rb

Defined Under Namespace

Classes: Cache, FogStorage, LocalFile, OnTheFly, S3

Class Method Summary collapse

Class Method Details

.with_new_identifier(suffix = nil, seed = Time.now) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/adhoq/storage.rb', line 9

def with_new_identifier(suffix = nil, seed = Time.now)
  dirname, fname_seed = ['%Y-%m-%d', '%H%M%S.%L'].map {|f| seed.strftime(f) }

  basename = "%s_%05d%s" % [fname_seed, Process.pid, suffix]

  [dirname, basename].join('/').tap {|id| yield id }
end