lib/roo/generic_spreadsheet.rb in roo-0.8.4 vs lib/roo/generic_spreadsheet.rb in roo-0.8.5
- old
+ new
@@ -260,12 +260,10 @@
end
result
end
# write the current spreadsheet to stdout or into a file
- #TODO: refactoring --> GenericSpreadsheet
-
def to_csv(filename=nil,sheet=nil)
sheet = @default_sheet unless sheet
if filename
file = File.open(filename,"w") # do |file|
write_csv_content(file,sheet)
@@ -406,13 +404,13 @@
end
end
ret
end
- #TODO: refactoring to GenericSpreadsheet?
def write_csv_content(file=nil,sheet=nil)
+ # sheet = @default_sheet unless sheet
file = STDOUT unless file
- if first_row # sheet is not empty
+ if first_row(sheet) # sheet is not empty
first_row(sheet).upto(last_row(sheet)) do |row|
1.upto(last_column(sheet)) do |col|
file.print(",") if col > 1
onecell = cell(row,col,sheet)
onecelltype = celltype(row,col,sheet)