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.
75 76 77 78 79 80 81 82 |
# File 'lib/eeepub/maker.rb', line 75 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
69 70 71 72 |
# File 'lib/eeepub/maker.rb', line 69 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})
95 96 97 |
# File 'lib/eeepub/maker.rb', line 95 def render create_epub.render end |
#save(filename) ⇒ Object
Save as ePub file
87 88 89 |
# File 'lib/eeepub/maker.rb', line 87 def save(filename) create_epub.save(filename) end |