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.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
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.
38 39 40 41 42 43 |
# File 'lib/eeepub/easy.rb', line 38 def initialize(&block) @sections = [] @assets = [] @urls = [] super end |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
35 36 37 |
# File 'lib/eeepub/easy.rb', line 35 def assets @assets end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
35 36 37 |
# File 'lib/eeepub/easy.rb', line 35 def sections @sections end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
35 36 37 |
# File 'lib/eeepub/easy.rb', line 35 def urls @urls end |
Instance Method Details
#save(filename) ⇒ Object
Save as ePub file
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 77 78 |
# File 'lib/eeepub/easy.rb', line 48 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 |