Sha256: 92e0221904a7acc741fd2131d6113ba484abbac3bc9fde74bbb075e8b728c58f

Contents?: true

Size: 613 Bytes

Versions: 6

Compression:

Stored size: 613 Bytes

Contents

module Adhoq
  module Storage
    autoload 'FogStorage', 'adhoq/storage/fog_storage'
    autoload 'LocalFile',  'adhoq/storage/local_file'
    autoload 'S3',         'adhoq/storage/s3'
    autoload 'OnTheFly',   'adhoq/storage/on_the_fly'
    autoload 'Cache',      'adhoq/storage/cache'

    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

6 entries across 6 versions & 1 rubygems

Version Path
adhoq-1.0.2 lib/adhoq/storage.rb
adhoq-1.0.1 lib/adhoq/storage.rb
adhoq-1.0.0 lib/adhoq/storage.rb
adhoq-0.5.0 lib/adhoq/storage.rb
adhoq-0.5.0.beta1 lib/adhoq/storage.rb
adhoq-0.4.0 lib/adhoq/storage.rb