Class: GEPUB::Gepuber
Defined Under Namespace
Classes: FileProvider
Instance Attribute Summary collapse
-
#coverimg ⇒ Object
Returns the value of attribute coverimg.
-
#epubname ⇒ Object
Returns the value of attribute epubname.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#table_of_contents ⇒ Object
Returns the value of attribute table_of_contents.
-
#texts ⇒ Object
Returns the value of attribute texts.
Attributes inherited from Book
Instance Method Summary collapse
- #create(destbasedir = ".") ⇒ Object
-
#initialize(param) ⇒ Gepuber
constructor
A new instance of Gepuber.
Methods inherited from Book
#add_item, #add_nav, #add_ordered_item, #add_ref_to_item, #container_xml, #cover_image_item, def_meta, #generate_epub, #identifier, #identifier=, #ncx_xml, #opf_xml, #setIdentifier, #specify_cover_image
Constructor Details
#initialize(param) ⇒ Gepuber
Returns a new instance of Gepuber.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gepub/gepuber.rb', line 24 def initialize(param) super('', 'OEBPS') param.each { |k,v| self.send "#{k}=", v } @texts ||= ['[0-9]*.html'] @resources ||= ['*.css', 'img/*'] @coverimg ||= 'cover.jpg' @table_of_contents ||= {} @epubname ||= 'gepuber_generated' @provider ||= FileProvider end |
Instance Attribute Details
#coverimg ⇒ Object
Returns the value of attribute coverimg.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def coverimg @coverimg end |
#epubname ⇒ Object
Returns the value of attribute epubname.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def epubname @epubname end |
#provider ⇒ Object
Returns the value of attribute provider.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def provider @provider end |
#resources ⇒ Object
Returns the value of attribute resources.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def resources @resources end |
#table_of_contents ⇒ Object
Returns the value of attribute table_of_contents.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def table_of_contents @table_of_contents end |
#texts ⇒ Object
Returns the value of attribute texts.
22 23 24 |
# File 'lib/gepub/gepuber.rb', line 22 def texts @texts end |
Instance Method Details
#create(destbasedir = ".") ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gepub/gepuber.rb', line 38 def create(destbasedir = ".") @provider.new(@texts).each { |f, fio| item = add_item(f, fio) @spine << item if !@table_of_contents[f].nil? add_nav(item, @table_of_contents[f]) @table_of_contents.each { |k,v| k =~ /^#{f}#(.*)$/ add_nav(item, v, $1) unless $1.nil? } end } @provider.new(@resources).each { |f, fio| item = add_item(f, fio) specify_cover_image(item) if File.basename(f) == @coverimg } generate_epub(File.join(destbasedir, @epubname + '.epub')) end |