lib/roo/generic_spreadsheet.rb in roo-0.9.0 vs lib/roo/generic_spreadsheet.rb in roo-0.9.1

- old
+ new

@@ -302,20 +302,33 @@ end result = Array.new #-- id if args[0].class == Fixnum rownum = args[0] - tmp = {} + if @header_line + tmp = {} + else + tmp = [] + end 1.upto(self.row(rownum).size) {|j| x = '' column_with.each { |key,val| if val == j x = key end } - tmp[x] = cell(rownum,j) + if @header_line + tmp[x] = cell(rownum,j) + else + tmp[j-1] = cell(rownum,j) + end + } - result = [ tmp ] # row(rownum) + if @header_line + result = [ tmp ] + else + result = tmp + end #-- :all elsif args[0] == :all if args[1].class == Hash args[1].each {|key,val| if key == :conditions