Class: Writexlsx::Worksheet::StringCellData

Inherits:
CellData
  • Object
show all
Defined in:
lib/write_xlsx/worksheet/cell_data.rb

Overview

:nodoc:

Direct Known Subclasses

RichStringCellData

Constant Summary collapse

TYPE_STR_ATTRS =
%w[t s].freeze

Constants included from Constants

Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Instance Attribute Summary collapse

Attributes inherited from CellData

#xf

Instance Method Summary collapse

Methods inherited from CellData

#cell_attributes

Methods included from Utility::CellReference

#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell

Methods included from Utility::Common

#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message

Constructor Details

#initialize(index, xf, raw_string) ⇒ StringCellData

Returns a new instance of StringCellData.



65
66
67
68
69
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 65

def initialize(index, xf, raw_string)
  @token = index
  @xf = xf
  @raw_string = raw_string
end

Instance Attribute Details

#raw_stringObject (readonly)

Returns the value of attribute raw_string.



63
64
65
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 63

def raw_string
  @raw_string
end

#tokenObject (readonly)

Returns the value of attribute token.



63
64
65
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 63

def token
  @token
end

Instance Method Details

#dataObject



71
72
73
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 71

def data
  { sst_id: token }
end

#display_url_string?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 84

def display_url_string?
  false
end

#write_cell(worksheet, row, row_name, col) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 76

def write_cell(worksheet, row, row_name, col)
  attributes = cell_attributes(worksheet, row, row_name, col)
  attributes << TYPE_STR_ATTRS
  worksheet.writer.tag_elements('c', attributes) do
    worksheet.write_cell_value(token)
  end
end