class WriteXlsxRails::WriteXlsxBuilder

Public Class Methods

call(template) click to toggle source
# File lib/write_xlsx_rails/template_handler.rb, line 10
    def self.call(template)
      <<-TEMPLATE.gsub(/\n/, ';').gsub('{{source}}', template.source)
      require 'stringio'

      __io = StringIO.new

      __workbook_defined = defined? workbook
      workbook = WriteXLSX.new(__io) unless __workbook_defined

      {{source}}

      workbook.close unless __workbook_defined

      __io.flush
      __io.string
      TEMPLATE
    end

Public Instance Methods

default_format() click to toggle source
# File lib/write_xlsx_rails/template_handler.rb, line 6
def default_format
  Mime::XLSX
end