Module: Decisive::DSL

Defined in:
lib/decisive/template_handler.rb

Instance Method Summary collapse

Instance Method Details

#csv(records, filename:, stream: true, &block) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/decisive/template_handler.rb', line 57

def csv records, filename:, stream: true, &block
  @stream = stream
  if stream
    raise StreamingNotEnabledByControllerError unless controller.is_a?(ActionController::Live)
    raise StreamIncompatibleBlockArgumentError if block.arity != 0
    StreamCSVContext.new(records, filename, block)
  else
    RenderCSVContext.new(records, filename, block)
  end
end

#xls(worksheets = nil, filename:, &block) ⇒ Object



68
69
70
# File 'lib/decisive/template_handler.rb', line 68

def xls worksheets=nil, filename:, &block
  RenderXLSContext.new(worksheets, filename, block)
end