Class: ZipFileExtractor

Inherits:
Object
  • Object
show all
Defined in:
app/services/zip_file_extractor.rb

Constant Summary collapse

OUTPUT_PATH =
File.join('public', 'vinsol_spree_themes')
IGNORED_FILES_REGEX =
/\/(\.|__)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, theme) ⇒ ZipFileExtractor

Returns a new instance of ZipFileExtractor.



10
11
12
13
# File 'app/services/zip_file_extractor.rb', line 10

def initialize(file_path, theme)
  @file_path = file_path
  @theme = theme
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



8
9
10
# File 'app/services/zip_file_extractor.rb', line 8

def file_path
  @file_path
end

#themeObject (readonly)

Returns the value of attribute theme.



8
9
10
# File 'app/services/zip_file_extractor.rb', line 8

def theme
  @theme
end

Instance Method Details

#extractObject



15
16
17
18
# File 'app/services/zip_file_extractor.rb', line 15

def extract
  FileUtils.mkdir_p(OUTPUT_PATH)
  parse_file
end