Class: Epubber::Generators::Introduction

Inherits:
Generator
  • Object
show all
Defined in:
lib/epubber/generators/introduction.rb

Instance Attribute Summary

Attributes inherited from Generator

#book, #persistance

Instance Method Summary collapse

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Epubber::Generators::Generator

Instance Method Details

#generateObject



5
6
7
8
9
10
11
12
# File 'lib/epubber/generators/introduction.rb', line 5

def generate
  # Because this is an optional generator, don't do anything if there's no
  # introduction in the book
  return if book.introduction.nil?

  content = template.parse file: 'OEBPS/Text/introduction.xhtml', context: book_context
  persist file: 'OEBPS/Text/introduction.xhtml', content: content
end