Class: EpubTools::XHTMLExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/epub_tools/xhtml_extractor.rb

Overview

Extracts .xhtml files from EPUB archives, excluding nav.xhtml

Instance Method Summary collapse

Constructor Details

#initialize(source_dir:, target_dir:, verbose: false) ⇒ XHTMLExtractor

Returns a new instance of XHTMLExtractor.



7
8
9
10
11
12
# File 'lib/epub_tools/xhtml_extractor.rb', line 7

def initialize(source_dir:, target_dir:, verbose: false)
  @source_dir = File.expand_path(source_dir)
  @target_dir = File.expand_path(target_dir)
  @verbose = verbose
  FileUtils.mkdir_p(@target_dir)
end

Instance Method Details

#extract_allObject



14
15
16
17
18
# File 'lib/epub_tools/xhtml_extractor.rb', line 14

def extract_all
  epub_files.each do |epub_path|
    extract_xhtmls_from(epub_path)
  end
end