lib/axlsx/workbook/worksheet/cell.rb in axlsx-1.0.14 vs lib/axlsx/workbook/worksheet/cell.rb in axlsx-1.0.15

- old
+ new

@@ -46,11 +46,11 @@ attr_reader :type # @see type def type=(v) RestrictionValidator.validate "Cell.type", [:time, :float, :integer, :string], v @type=v - self.value = @value + self.value = @value unless @value.nil? end # The value of this cell. # @return [String, Integer, Float, Time] casted value based on cell's type attribute. @@ -173,17 +173,17 @@ # @option options [Symbol] vertAlign must be one of :baseline, :subscript, :superscript # @option options [Integer] sz # @option options [String] color an 8 letter rgb specification # @option options [Symbol] scheme must be one of :none, major, :minor def initialize(row, value="", options={}) - self.row=row + self.row=row @styles = row.worksheet.workbook.styles - @style = 0 - @type = cell_type_from_value(value) @row.cells << self options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end + @style ||= 0 + @type ||= cell_type_from_value(value) @value = cast_value(value) end # @return [Integer] The index of the cell in the containing row. def index