Class: RubyXL::Writer::GenericWriter
- Inherits:
-
Object
- Object
- RubyXL::Writer::GenericWriter
show all
- Defined in:
- lib/rubyXL/writer/generic_writer.rb
Direct Known Subclasses
AppWriter, CalcChainWriter, ContentTypesWriter, CoreWriter, RootRelsWriter, SharedStringsWriter, StylesWriter, ThemeWriter, WorkbookRelsWriter, WorkbookWriter, WorksheetWriter
Instance Method Summary
collapse
Constructor Details
Returns a new instance of GenericWriter.
8
9
10
11
12
|
# File 'lib/rubyXL/writer/generic_writer.rb', line 8
def initialize(workbook)
@workbook = workbook
end
|
Instance Method Details
#add_to_zip(zipfile) ⇒ Object
27
28
29
|
# File 'lib/rubyXL/writer/generic_writer.rb', line 27
def add_to_zip(zipfile)
zipfile.get_output_stream(filepath) { |f| f << write }
end
|
#filepath ⇒ Object
14
15
16
|
# File 'lib/rubyXL/writer/generic_writer.rb', line 14
def filepath
raise 'Subclass responsebility'
end
|
#render_xml {|seed_xml| ... } ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/rubyXL/writer/generic_writer.rb', line 18
def render_xml
seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
seed_xml.encoding = 'UTF-8'
yield(seed_xml)
seed_xml.to_xml({ :indent => 0, :save_with => Nokogiri::XML::Node::SaveOptions::AS_XML })
end
|