export_to_spreadsheet 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sales_clic_exporter/base.rb +8 -4
- data/lib/sales_clic_exporter/excel.rb +1 -0
- data/lib/sales_clic_exporter/google_spreadsheets.rb +1 -0
- metadata +3163 -3178
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
1
2
|
# Document describes a format to which data can be exported.
|
2
3
|
# A document can contain titles, lines or arrays.
|
3
4
|
module SalesClicExporter::Document
|
@@ -79,10 +80,13 @@ module SalesClicExporter::Document
|
|
79
80
|
# Extraction du dernier argument
|
80
81
|
options = (headers_with_options.last.kind_of?(Hash) && headers_with_options.respond_to?('each')) ? headers_with_options.pop : {}
|
81
82
|
|
82
|
-
#
|
83
|
-
#
|
84
|
-
|
85
|
-
|
83
|
+
# At this point headers_with_options only contains the headers so we rename the variable for readability
|
84
|
+
# If the headers were passed as an array then they will be contained in another array, i.e. [['a', 'b', 'c']] so we extract them
|
85
|
+
headers = if headers_with_options.size == 1 && headers_with_options.first.kind_of?(Array)
|
86
|
+
headers_with_options.first
|
87
|
+
else
|
88
|
+
headers_with_options
|
89
|
+
end
|
86
90
|
|
87
91
|
# Dans la méthode #line on utilise le même mécanisme pour contenir les options dans la liste d'arguments.
|
88
92
|
# C'est pour cette raison qu'on réintègre les options dans le header, et qu'on passe le tout en argument
|