module Decisive::DSL

Public Instance Methods

csv(records, filename:, stream: true, &block) click to toggle source
# File lib/decisive/template_handler.rb, line 57
def csv records, filename:, stream: true, &block
  if stream
    raise StreamingNotEnabledByControllerError unless controller.is_a?(ActionController::Live)
    raise StreamIncompatibleBlockArgumentError if block.arity != 0
    StreamContext.new([], records, filename, &block)
  else
    RenderContext.new(records, filename, block)
  end
end
xls(worksheets=nil, filename:, &block) click to toggle source
# File lib/decisive/template_handler.rb, line 67
def xls worksheets=nil, filename:, &block
  if worksheets
    XLSContext.new(worksheets, filename, block)
  else
    XLSWithWorksheetsContext.new(filename, [], &block)
  end
end