Class: EeePub::Maker
- Inherits:
-
Object
- Object
- EeePub::Maker
- Defined in:
- lib/eeepub/maker.rb
Overview
The class to make ePub easily
Note on unique identifiers:
At least one 'identifier' must be the unique identifer represented by the name
given to 'uid' and set via the hash option :id => {name}. The default name for
uid is 'BookId' and doesn't need to be specified explicitly. If no identifier is
marked as the unique identifier, the first one give will be chosen.
Direct Known Subclasses
Instance Method Summary collapse
- #identifier(id, options) ⇒ Object
-
#initialize(&block) ⇒ Maker
constructor
A new instance of Maker.
-
#render ⇒ Object
instead of saving to file, output the file contents.
-
#save(filename) ⇒ Object
Save as ePub file.
Constructor Details
#initialize(&block) ⇒ Maker
Returns a new instance of Maker.
72 73 74 75 76 77 78 79 |
# File 'lib/eeepub/maker.rb', line 72 def initialize(&block) @files ||= [] @nav ||= [] @ncx_file ||= 'toc.ncx' @opf_file ||= 'content.opf' instance_eval(&block) if block_given? end |
Instance Method Details
#identifier(id, options) ⇒ Object
66 67 68 69 |
# File 'lib/eeepub/maker.rb', line 66 def identifier(id, ) @identifiers ||= [] @identifiers << {:value => id, :scheme => [:scheme], :id => [:id]} end |
#render ⇒ Object
instead of saving to file, output the file contents. important for serving on-the-fly doc creation from web interface where we don’t want to allow file system writes (Heroku, et al.)
92 93 94 |
# File 'lib/eeepub/maker.rb', line 92 def render create_epub.render end |
#save(filename) ⇒ Object
Save as ePub file
84 85 86 |
# File 'lib/eeepub/maker.rb', line 84 def save(filename) create_epub.save(filename) end |