Sha256: 78260925e7bb997c9633e3064798d9025732869bb84e8f4901f738daec4e91b7

Contents?: true

Size: 564 Bytes

Versions: 7

Compression:

Stored size: 564 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'

    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

7 entries across 7 versions & 1 rubygems

Version Path
adhoq-0.3.0 lib/adhoq/storage.rb
adhoq-0.2.0 lib/adhoq/storage.rb
adhoq-0.1.2 lib/adhoq/storage.rb
adhoq-0.1.1 lib/adhoq/storage.rb
adhoq-0.1.0 lib/adhoq/storage.rb
adhoq-0.0.7 lib/adhoq/storage.rb
adhoq-0.0.6 lib/adhoq/storage.rb