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.
@@ -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
- # Pour plus de lisibilité on renomme la variable à utiliser dans le reste de la méthode
83
- # Le * permet d'appliatir le tableau d'arguments, qui est contenu dans un tableau sinon (en fait, à ce moment
84
- # headers_with_options (sans le *) vaut [['a', 'b', 'c']] par exemple
85
- headers = *headers_with_options
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
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module SalesClicExporter::Document
2
3
 
3
4
  # Describes an Excel document
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module SalesClicExporter::Document
2
3
 
3
4
  # Describes a Google Spreadsheets document