diff options
| author | Paul Kmiec <[email protected]> | 2023-05-15 17:04:59 -0700 |
|---|---|---|
| committer | Paul Kmiec <[email protected]> | 2023-05-15 17:04:59 -0700 |
| commit | 1201ef7145463a14d263a093d7d53a2f235e48e0 (patch) | |
| tree | c4e60b2bd74fb22fb93e3bad1cef15f7bdc4e244 | |
| parent | 447b2522bc4a06c8436e708eae40cf7244dc0ec4 (diff) | |
| download | caxlsx-1201ef7145463a14d263a093d7d53a2f235e48e0.tar.gz caxlsx-1201ef7145463a14d263a093d7d53a2f235e48e0.zip | |
Remove ability to set `u=` to true in favor of :single
The `u=` would convert `true` to `:single` for backwards compatibility.
However, it is more explicit to set it to `:single` or one of the other
underline options instead of relying on the conversion.
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | lib/axlsx/util/validators.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_cell.rb | 2 |
4 files changed, 4 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 19f5d742..92d3396f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG - Drop support for Ruby versions < 2.6 - Added frozen string literals - Fix `SimpleTypedList#to_a` and `SimpleTypedList#to_ary` returning the internal list instance + - Remove ability to set `u=` to true in favor of using :single or one of the other underline options - **April.23.23**: 3.4.1 - [PR #209](https://github.com/caxlsx/caxlsx/pull/209) - Revert characters other than `=` being considered as formulas. diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 752ffc76..e9cf13b6 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -107,9 +107,7 @@ module Axlsx end VALID_BOOLEAN_CLASSES = [TrueClass, FalseClass, Integer, String, Symbol].freeze - VALID_BOOLEAN_TRUE_VALUES = [true, 1, '1', 'true', :true].freeze - VALID_BOOLEAN_FALSE_VALUES = [false, 0, '0', 'false', :false].freeze - VALID_BOOLEAN_VALUES = VALID_BOOLEAN_TRUE_VALUES.zip(VALID_BOOLEAN_FALSE_VALUES).flatten.freeze + VALID_BOOLEAN_VALUES = [true, false, 1, 0, '1', '0', 'true', 'false', :true, :false].freeze BOOLEAN_VALIDATOR = lambda { |arg| VALID_BOOLEAN_VALUES.include?(arg) } # Requires that the value is a form that can be evaluated as a boolean in an xml document. diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index b44656e3..cbf55482 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -285,15 +285,13 @@ module Axlsx def extend=(v) set_run_style :validate_boolean, :extend, v; end # The inline underline property for the cell. - # It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting, true + # It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting # @return [Boolean] # @return [String] - # @note true is for backwards compatability and is reassigned to :single attr_reader :u # @see u def u=(v) - v = :single if VALID_BOOLEAN_TRUE_VALUES.include?(v) set_run_style :validate_cell_u, :u, v end diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index a534a8dc..fef23ede 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -567,7 +567,7 @@ class TestCell < Test::Unit::TestCase def test_to_xml # TODO: This could use some much more stringent testing related to the xml content generated! @ws.add_row [Time.now, Date.today, true, 1, 1.0, "text", "=sum(A1:A2)", "2013-01-13T13:31:25.123"] - @ws.rows.last.cells[5].u = true + @ws.rows.last.cells[5].u = :single schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(@ws.to_xml_string) |
