Class: Adhoq::Storage::FogStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/adhoq/storage/fog_storage.rb

Direct Known Subclasses

LocalFile, S3

Instance Method Summary collapse

Instance Method Details

#direct_download?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/adhoq/storage/fog_storage.rb', line 13

def direct_download?
  false
end

#get(identifier) ⇒ Object



17
18
19
# File 'lib/adhoq/storage/fog_storage.rb', line 17

def get(identifier)
  get_raw(identifier).body
end

#get_raw(identifier) ⇒ Object



21
22
23
# File 'lib/adhoq/storage/fog_storage.rb', line 21

def get_raw(identifier)
  directory.files.head(identifier)
end

#store(suffix = nil, seed = Time.now, &block) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/adhoq/storage/fog_storage.rb', line 4

def store(suffix = nil, seed = Time.now, &block)
  Adhoq::Storage.with_new_identifier(suffix, seed) do |identifier|
    io = yield
    io.rewind

    directory.files.create(key: identifier, body: io, public: false)
  end
end