Class: LyndaTranslatorSrt::SrtOriginal::Unzipper
- Inherits:
-
Object
- Object
- LyndaTranslatorSrt::SrtOriginal::Unzipper
- Defined in:
- lib/lynda_translator_srt/srt_original/unzipper.rb
Instance Attribute Summary collapse
-
#path_unzip_folder ⇒ Object
readonly
Returns the value of attribute path_unzip_folder.
Instance Method Summary collapse
-
#initialize(tmp_file_path) ⇒ Unzipper
constructor
A new instance of Unzipper.
- #unzip ⇒ Object
- #unzipped? ⇒ Boolean
Constructor Details
#initialize(tmp_file_path) ⇒ Unzipper
Returns a new instance of Unzipper.
8 9 10 |
# File 'lib/lynda_translator_srt/srt_original/unzipper.rb', line 8 def initialize(tmp_file_path) @tmp_file_path = tmp_file_path end |
Instance Attribute Details
#path_unzip_folder ⇒ Object (readonly)
Returns the value of attribute path_unzip_folder.
6 7 8 |
# File 'lib/lynda_translator_srt/srt_original/unzipper.rb', line 6 def path_unzip_folder @path_unzip_folder end |
Instance Method Details
#unzip ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/lynda_translator_srt/srt_original/unzipper.rb', line 12 def unzip name_unzip_folder = "srt_original_#{Time.now.utc.iso8601}" @path_unzip_folder = Dir.tmpdir + "/" + name_unzip_folder FileUtils::mkdir_p @path_unzip_folder @unzipped = system "unzip -o #{@tmp_file_path} -d #{@path_unzip_folder}" FileUtils::rm @tmp_file_path if unzipped? if unzipped? puts "Unzipped course" self else raise("Unfortunately we doesn't unzipped transcript to this course.") end end |
#unzipped? ⇒ Boolean
30 31 32 |
# File 'lib/lynda_translator_srt/srt_original/unzipper.rb', line 30 def unzipped? @unzipped end |