From b6b2cce467f37b6a3ebfea668604bb9ec2f00f09 Mon Sep 17 00:00:00 2001 From: ochko Date: Fri, 16 Dec 2011 17:46:20 +0900 Subject: Little performance improvement. It doesn't need to do type detection if it is passed by options --- lib/axlsx/workbook/worksheet/cell.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 7e043438..0f06bd13 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -175,14 +175,14 @@ module Axlsx # @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 -- cgit v1.2.3