Class: Repub::Epub::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/repub/epub/container.rb

Instance Method Summary collapse

Instance Method Details

#save(path = 'container.xml') ⇒ Object



20
21
22
23
24
# File 'lib/repub/epub/container.rb', line 20

def save(path = 'container.xml')
  File.open(path, 'w') do |f|
    f << to_xml
  end
end

#to_xmlObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/repub/epub/container.rb', line 8

def to_xml
  out = ''
  builder = Builder::XmlMarkup.new(:target => out, :indent => 4)
  builder.instruct!
  builder.container :xmlns => "urn:oasis:names:tc:opendocument:xmlns:container", :version => "1.0" do
    builder.rootfiles do
      builder.rootfile 'full-path' => "content.opf", 'media-type' => "application/oebps-package+xml"
    end
  end
  out
end