Method: EpubBook#initialize
- Defined in:
- lib/epub_book.rb
#initialize(filename, options = {}) ⇒ EpubBook
Returns a new instance of EpubBook.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/epub_book.rb', line 10 def initialize(filename,={}) raise '无效的文件' unless File.exists?(filename) @title = [:title] = [:author] @publisher = [:publisher] @pubdate= [:pubdate] @isbn = [:isbn] text = Utils.extract_text_from_file(filename,'.epub') unless Utils.detect_utf8(text) text = Utils.to_utf8(text) end text = preprocess_content(text) @outline, @content = extract_for_epub_text(text) end |