Class: ODF::Document
Direct Known Subclasses
Class Method Summary collapse
Methods inherited from Container
Class Method Details
.file(ods_file_name, &contents) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/odf/document.rb', line 30 def self.file(ods_file_name, &contents) ods_file = Zip::ZipFile.open(ods_file_name, Zip::ZipFile::CREATE) ods_file.get_output_stream('styles.xml') {|f| f << skeleton.styles } ods_file.get_output_stream('META-INF/manifest.xml') {|f| f << skeleton.manifest(doc_type) } (doc = new).instance_eval(&contents) ods_file.get_output_stream('content.xml') {|f| f << doc.xml} ods_file.close end |