Class: GoogleDataSource::DataSource::CsvData
- Defined in:
- lib/google_data_source/csv_data.rb
Instance Attribute Summary
Attributes inherited from Base
#callback, #column_labels, #errors, #export_filename, #formatters, #reporting, #virtual_columns, #xml_class
Instance Method Summary collapse
-
#response ⇒ Object
include ActionView::Helpers::NumberHelper.
Methods inherited from Base
#[], #[]=, #add_error, #column_ids, #columns, #columns=, #data, #data=, #format, #formatter, from_gdata_params, from_params, #guess_columns, #has_formatter?, #is_virtual_column?, #required_columns, #set, #set_required_columns, #valid?, #validate, #virtual_column
Instance Method Details
#response ⇒ Object
include ActionView::Helpers::NumberHelper
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/google_data_source/csv_data.rb', line 8 def response result = CSV.generate(:col_sep => ';') do |csv| csv << columns.map { |col| col.label || col.id || col.type } data.each do |datarow| csv << datarow.map do |c| c.is_a?(Hash) ? c[:v] : c # TODO #value.is_a?(Float) ? number_with_delimiter(value) : value end end end result.force_encoding 'UTF-8' end |