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
# 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
    StreamCSVContext.new(records, filename, block)
  else
    RenderCSVContext.new(records, filename, block)
  end
end

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



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

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