Class: EeePub::Easy
Overview
The class to make ePub more easily
Instance Attribute Summary collapse
-
#assets ⇒ Object
readonly
Returns the value of attribute assets.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Easy
constructor
A new instance of Easy.
-
#save(filename) ⇒ Object
Save as ePub file.
Methods inherited from Maker
Constructor Details
#initialize(&block) ⇒ Easy
Returns a new instance of Easy.
37 38 39 40 41 |
# File 'lib/eeepub/lib/eeepub/easy.rb', line 37 def initialize(&block) @sections = [] @assets = [] super end |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
34 35 36 |
# File 'lib/eeepub/lib/eeepub/easy.rb', line 34 def assets @assets end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
34 35 36 |
# File 'lib/eeepub/lib/eeepub/easy.rb', line 34 def sections @sections end |
Instance Method Details
#save(filename) ⇒ Object
Save as ePub file
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/eeepub/lib/eeepub/easy.rb', line 46 def save(filename) Dir.mktmpdir do |dir| prepare(dir) NCX.new( :uid => @uid, :title => @titles[0], :nav => @nav ).save(File.join(dir, @ncx_file)) OPF.new( :title => @titles, :identifier => @identifiers, :creator => @creators, :publisher => @publishers, :date => @dates, :language => @languages, :subject => @subjects, :description => @descriptions, :rights => @rightss, :relation => @relations, :manifest => @files.map{|i| File.basename(i)}, :ncx => @ncx_file ).save(File.join(dir, @opf_file)) OCF.new( :dir => dir, :container => @opf_file ).save(filename) end end |