lib/axlsx/workbook/worksheet/cell.rb in axlsx-1.3.6 vs lib/axlsx/workbook/worksheet/cell.rb in axlsx-2.0.0

- old
+ new

@@ -300,11 +300,11 @@ # @param [String] str The string index the cell content will be appended to. Defaults to empty string. # @return [String] xml text for the cell def to_xml_string(r_index, c_index, str = '') CellSerializer.to_xml_string r_index, c_index, self, str end - + def is_formula? @type == :string && @value.to_s.start_with?('=') end # This is still not perfect... @@ -316,13 +316,13 @@ font_scale = (font_size/10.0).to_f ((value.to_s.count(Worksheet.thin_chars) * mdw + 5) / mdw * 256) / 256.0 * font_scale end # returns the absolute or relative string style reference for - # this cell. + # this cell. # @param [Boolean] absolute -when false a relative reference will be - # returned. + # returned. # @return [String] def reference(absolute=true) absolute ? r_abs : r end @@ -351,11 +351,11 @@ @ssti = v end # assigns the owning row for this cell. def row=(v) @row=v end - + # Determines the cell type based on the cell value. # @note This is only used when a cell is created but no :type option is specified, the following rules apply: # 1. If the value is an instance of Date, the type is set to :date # 2. If the value is an instance of Time, the type is set to :time # 3. If the value is an instance of TrueClass or FalseClass, the type is set to :boolean @@ -373,10 +373,10 @@ :integer elsif v.to_s =~ /\A[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\Z/ #float :float # \A(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9]) # T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)? - # (Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z + # (Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z elsif v.to_s =~/\A(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?\Z/ :iso_8601 else :string end