Class: UndriveGoogle::Transformations::Unzip

Inherits:
Object
  • Object
show all
Defined in:
lib/undrive_google/transformations/unzip.rb

Overview

Download a particular version of the file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, destination = nil) ⇒ Unzip

Returns a new instance of Unzip.



9
10
11
12
# File 'lib/undrive_google/transformations/unzip.rb', line 9

def initialize(file_path, destination = nil)
  @file_path = file_path
  @destination = destination || File.dirname(file_path)
end

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



7
8
9
# File 'lib/undrive_google/transformations/unzip.rb', line 7

def destination
  @destination
end

#file_pathObject

Returns the value of attribute file_path.



7
8
9
# File 'lib/undrive_google/transformations/unzip.rb', line 7

def file_path
  @file_path
end

#html_pathObject

Returns the value of attribute html_path.



7
8
9
# File 'lib/undrive_google/transformations/unzip.rb', line 7

def html_path
  @html_path
end

Instance Method Details

#processObject

Returns nil.

Returns:

  • nil



15
16
17
18
19
20
21
22
23
# File 'lib/undrive_google/transformations/unzip.rb', line 15

def process
  return unless Options.instance.unzip

  puts "Unzipping #{file_path}" if Options.instance.verbose
  extract_zip(file_path, destination)
  puts "Unzipped #{file_path} to #{html_path}" if Options.instance.verbose

  nil
end