Class: EpubTools::EpubInitializer
- Inherits:
-
Object
- Object
- EpubTools::EpubInitializer
- Includes:
- Loggable
- Defined in:
- lib/epub_tools/epub_initializer.rb
Overview
Sets up a basic empty EPUB directory structure with the basic files created:
-
mimetype -
container.xml -
title.xhtmlas a title page -
package.opf -
nav.xhtmlas a table of contents -
style.cssa basic style inherited from the repo -
cover image (optionally)
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ EpubInitializer
constructor
Initializes the class.
-
#run ⇒ Object
Creates the empty ebook and returns the directory.
Methods included from Loggable
Constructor Details
#initialize(options = {}) ⇒ EpubInitializer
Initializes the class
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/epub_tools/epub_initializer.rb', line 25 def initialize( = {}) @title = .fetch(:title) = .fetch(:author) @destination = File.(.fetch(:destination)) @uuid = "urn:uuid:#{SecureRandom.uuid}" @modified = Time.now.utc.iso8601 @cover_image_path = [:cover_image] @cover_image_fname = nil @cover_image_media_type = nil @verbose = [:verbose] || false end |
Instance Method Details
#run ⇒ Object
Creates the empty ebook and returns the directory
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/epub_tools/epub_initializer.rb', line 38 def run create_structure write_mimetype write_title_page write_container write_cover if @cover_image_path write_package_opf write_nav write_style log "Created empty ebook structure at: #{@destination}" @destination end |