Sha256: b624b16f1b86c3772afb987f0a901a34178100deb64e2efe462adb441a0cffc1

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

module Adhoq
  module Storage
    autoload 'FogStorage', 'adhoq/storage/fog_storage'
    autoload 'LocalFile',  'adhoq/storage/local_file'
    autoload 'S3',         'adhoq/storage/s3'

    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
    module_function :with_new_identifier
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhoq-0.0.5 lib/adhoq/storage.rb
adhoq-0.0.4 lib/adhoq/storage.rb
adhoq-0.0.3 lib/adhoq/storage.rb