Class: Aozora2Html::Zip

Inherits:
Object
  • Object
show all
Defined in:
lib/aozora2html/zip.rb

Overview

zipファイルからテキストを抽出する

Class Method Summary collapse

Class Method Details

.unzip(zipfilename, textfilename) ⇒ Object



8
9
10
11
12
13
# File 'lib/aozora2html/zip.rb', line 8

def self.unzip(zipfilename, textfilename)
  ::Zip::File.open(zipfilename) do |zip_file|
    entry = zip_file.glob('*.txt').first
    entry.extract(textfilename)
  end
end