lib/axlsx/workbook/worksheet/row.rb in axlsx-1.0.0 vs lib/axlsx/workbook/worksheet/row.rb in axlsx-1.0.1

- old
+ new

@@ -28,15 +28,15 @@ # @option options [Array] values # @option options [Array, Symbol] types # @option options [Array, Integer] style # @see Row#array_to_cells # @see Cell - def initialize(worksheet, options={}) + def initialize(worksheet, values=[], options={}) self.worksheet = worksheet @cells = SimpleTypedList.new Cell @worksheet.rows << self - array_to_cells(options) + array_to_cells(values, options) end def index worksheet.rows.index(self) end @@ -75,11 +75,11 @@ # If the style option is defined and is an Integer, it is applied to all cells created. # If the style option is an array, style is applied by index for each cell. # @option options [Array] values # @option options [Array, Symbol] types # @option options [Array, Integer] style - def array_to_cells(options={}) - values = options[:values] || [] + def array_to_cells(values, options={}) + values = values DataTypeValidator.validate 'Row.array_to_cells', Array, values types, style = options[:types], options[:style] values.each_with_index do |value, index| cell_style = style.is_a?(Array) ? style[index] : style cell_type = types.is_a?(Array)? types[index] : types