Class: UndriveGoogle::Actions::Liberate

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/undrive_google/actions/liberate.rb

Overview

Liberate a file, and transform it

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(extension) ⇒ Liberate

Returns a new instance of Liberate.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/undrive_google/actions/liberate.rb', line 18

def initialize(extension)
  @extension = extension.to_s
  @file = Session.instance.file
  @dir = Options.instance.dir
  @file_path = "#{@dir}/#{name}"
  @tr = Transformation.new(download: Transformations::Download.new(@file_path, @extension))
  return unless zip?

  if Options.instance.unzip
    @tr.unzip = Transformations::Unzip.new(@file_path)
    @tr.fix_html = Transformations::FixHtml.new(@tr.unzip)
    @tr.rename_html = Transformations::RenameHtml.new(@tr.unzip) if Options.instance.rename[:html]
  end

  @tr.delete_zip = Transformations::DeleteZip.new(@file_path) unless Options.instance.keep_zip
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



9
10
11
# File 'lib/undrive_google/actions/liberate.rb', line 9

def dir
  @dir
end

#extensionObject

Returns the value of attribute extension.



9
10
11
# File 'lib/undrive_google/actions/liberate.rb', line 9

def extension
  @extension
end

#fileObject

Returns the value of attribute file.



9
10
11
# File 'lib/undrive_google/actions/liberate.rb', line 9

def file
  @file
end

#file_pathObject

Returns the value of attribute file_path.



9
10
11
# File 'lib/undrive_google/actions/liberate.rb', line 9

def file_path
  @file_path
end

#trObject

Returns the value of attribute tr.



9
10
11
# File 'lib/undrive_google/actions/liberate.rb', line 9

def tr
  @tr
end