Class: Pageflow::Panorama::UnpackToS3

Inherits:
Object
  • Object
show all
Defined in:
lib/pageflow/panorama/unpack_to_s3.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ UnpackToS3

Returns a new instance of UnpackToS3.



8
9
10
11
12
# File 'lib/pageflow/panorama/unpack_to_s3.rb', line 8

def initialize(options)
  @archive = options.fetch(:archive)
  @destination_bucket = options.fetch(:destination_bucket)
  @destination_base_path = options.fetch(:destination_base_path)
end

Instance Attribute Details

#archiveObject (readonly)

Returns the value of attribute archive.



6
7
8
# File 'lib/pageflow/panorama/unpack_to_s3.rb', line 6

def archive
  @archive
end

#destination_base_pathObject (readonly)

Returns the value of attribute destination_base_path.



6
7
8
# File 'lib/pageflow/panorama/unpack_to_s3.rb', line 6

def destination_base_path
  @destination_base_path
end

#destination_bucketObject (readonly)

Returns the value of attribute destination_bucket.



6
7
8
# File 'lib/pageflow/panorama/unpack_to_s3.rb', line 6

def destination_bucket
  @destination_bucket
end

Instance Method Details

#upload(&progress) ⇒ Object



14
15
16
17
18
19
# File 'lib/pageflow/panorama/unpack_to_s3.rb', line 14

def upload(&progress)
  archive.entries.each_with_index do |entry, index|
    yield(100.0 * index / archive.entries.size) if block_given?
    upload_entry(entry)
  end
end