From 407b884ef349d6dec12f50006ea6268c96205a83 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 27 Nov 2011 21:34:48 +0900 Subject: adding yields for package workbook, workbook styles and cols collection on worksheet to make charting easier. --- doc/Axlsx/Ar/SingletonMethods.html | 47 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'doc/Axlsx/Ar/SingletonMethods.html') diff --git a/doc/Axlsx/Ar/SingletonMethods.html b/doc/Axlsx/Ar/SingletonMethods.html index 9781895c..e2994ddd 100644 --- a/doc/Axlsx/Ar/SingletonMethods.html +++ b/doc/Axlsx/Ar/SingletonMethods.html @@ -158,28 +158,27 @@
# File 'lib/axlsx/ar.rb', line 22
 
-def to_xlsx(number = :all, options = {})
-  row_style = options.delete(:style)
-  header_style = options.delete(:header_style) || row_style
-  types = options.delete(:types)
-
-  data = [*find(number, options)]
-  data.compact!
-  data.flatten!
-  columns = data.first.attributes.keys
-  p = Package.new
-  row_style = p.workbook.styles.add_style(row_style) unless row_style.nil?
-  header_style = p.workbook.styles.add_style(header_style) unless header_style.nil?
-  
-  p.workbook.add_worksheet(:name=>table_name.humanize) do |sheet|
-    sheet.add_row columns, :style=>header_style
-    data.each do |r|
-      sheet.add_row r.attributes.values, :style=>row_style, :types=>types
-    end
-  end
-  p
-end
-
+def to_xlsx(number = :all, options = {}) + row_style = options.delete(:style) + header_style = options.delete(:header_style) || row_style + types = options.delete(:types) + + data = [*find(number, options)] + data.compact! + data.flatten! + columns = data.first.attributes.keys + p = Package.new + row_style = p.workbook.styles.add_style(row_style) unless row_style.nil? + header_style = p.workbook.styles.add_style(header_style) unless header_style.nil? + + p.workbook.add_worksheet(:name=>table_name.humanize) do |sheet| + sheet.add_row columns, :style=>header_style + data.each do |r| + sheet.add_row r.attributes.values, :style=>row_style, :types=>types + end + end + p +end @@ -190,9 +189,9 @@ -- cgit v1.2.3