Class: Burr::EpubMaker

Inherits:
Object show all
Defined in:
lib/burr/eeepub_ext/maker.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ EpubMaker

Returns a new instance of EpubMaker.

Parameters:

  • block (Proc)

    the block for initialize



47
48
49
50
51
52
53
54
# File 'lib/burr/eeepub_ext/maker.rb', line 47

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



41
42
43
44
# File 'lib/burr/eeepub_ext/maker.rb', line 41

def identifier(id, options)
  @identifiers ||= []
  @identifiers << {:value => id, :scheme => options[:scheme], :id => options[:id]}
end

#renderObject

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.)



67
68
69
# File 'lib/burr/eeepub_ext/maker.rb', line 67

def render
  create_epub.render
end

#save(filename) ⇒ Object

Save as ePub file

Parameters:

  • filename (String)

    the ePub file name to save



59
60
61
# File 'lib/burr/eeepub_ext/maker.rb', line 59

def save(filename)
  create_epub.save(filename)
end