Module: RenderAsCSV::InstanceMethods

Defined in:
lib/comma.rb

Instance Method Summary collapse

Instance Method Details

#render_with_csv(options = nil, extra_options = {}, &block) ⇒ Object



44
45
46
47
48
49
# File 'lib/comma.rb', line 44

def render_with_csv(options = nil, extra_options = {}, &block)
  return render_without_csv(options, extra_options, &block) unless (options.respond_to? '[]') and options[:csv]
  data = options.delete(:csv)
  style = options.delete(:style) || :default
  send_data Array(data).to_comma(style), options.merge(:type => :csv)
end