Module: Decisive::DSL

Defined in:
lib/decisive/template_handler.rb

Instance Method Summary collapse

Instance Method Details

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



50
51
52
53
54
55
56
57
58
# File 'lib/decisive/template_handler.rb', line 50

def csv records, filename:, stream: true, &block
  if stream
    raise StreamingNotEnabledByControllerError unless controller.respond_to?(:new_controller_thread) # has AC::Live mixed in
    raise StreamIncompatibleBlockArgumentError if block.arity != 0
    StreamContext.new([], records, filename, &block)
  else
    RenderContext.new(records, filename, block)
  end
end