class RubyXL::Writer::GenericWriter

Public Class Methods

new(workbook) click to toggle source
# File lib/rubyXL/writer/generic_writer.rb, line 8
def initialize(workbook)
  @workbook = workbook
  # +self.class+ makes sure constant is pulled from descendant class, not from this one.
  # self.class::FILEPATH
end

Public Instance Methods

add_to_zip(zipfile) click to toggle source
# File lib/rubyXL/writer/generic_writer.rb, line 27
def add_to_zip(zipfile)
  zipfile.get_output_stream(filepath) { |f| f << write }
end
filepath() click to toggle source
# File lib/rubyXL/writer/generic_writer.rb, line 14
def filepath
  raise 'Subclass responsebility'
end
render_xml() { |seed_xml| ... } click to toggle source
# 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