Class: Ungulate::BlobProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/ungulate/blob_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BlobProcessor

Returns a new instance of BlobProcessor.



3
4
5
# File 'lib/ungulate/blob_processor.rb', line 3

def initialize(options)
  @creator = options[:version_creator]
end

Instance Method Details

#process(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ungulate/blob_processor.rb', line 7

def process(options)
  versions = options.delete(:versions)
  blob = options.delete(:blob)
  original_key = options.delete(:original_key)
  bucket = options.delete(:bucket)

  versions.each_pair do |name, instructions|
    stored_data = @creator.create(blob, instructions)

    bucket.store(
      new_key(original_key, name),
      stored_data[:blob],
      :version => name,
      :content_type => stored_data[:content_type]
    )
  end
end