Class: EPUB::OCF::Container
- Inherits:
-
Object
- Object
- EPUB::OCF::Container
- Defined in:
- lib/epub/maker/ocf.rb
Instance Method Summary collapse
- #make_rootfile(full_path: nil, media_type: EPUB::MediaType::ROOTFILE) {|Rootfile| ... } ⇒ Object
- #to_xml(options = {:encoding => 'UTF-8'}) ⇒ Object
Instance Method Details
#make_rootfile(full_path: nil, media_type: EPUB::MediaType::ROOTFILE) {|Rootfile| ... } ⇒ Object
48 49 50 51 52 53 |
# File 'lib/epub/maker/ocf.rb', line 48 def make_rootfile(full_path: nil, media_type: EPUB::MediaType::ROOTFILE) rootfile = Rootfile.new(full_path, media_type) @rootfiles << rootfile yield rootfile if block_given? rootfile end |
#to_xml(options = {:encoding => 'UTF-8'}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/epub/maker/ocf.rb', line 32 def to_xml(={:encoding => 'UTF-8'}) Nokogiri::XML::Builder.new() {|xml| xml.container('xmlns' => EPUB::NAMESPACES['ocf'], 'version' => '1.0') { xml.rootfiles { rootfiles.each do |rootfile| xml.rootfile('full-path' => rootfile.full_path, 'media-type' => rootfile.media_type) end } } }.to_xml end |