diff options
| author | Paul Kmiec <[email protected]> | 2023-05-13 10:18:50 -0700 |
|---|---|---|
| committer | Paul Kmiec <[email protected]> | 2023-05-15 16:58:24 -0700 |
| commit | af8360755fe21f4e9d30e943ba0b2be3c0128d28 (patch) | |
| tree | ce7ea39f84aea2a988594eab9e2bb9a667713be8 /lib/axlsx/workbook/worksheet/cell.rb | |
| parent | e57d67b31d0edbdf3ffe1f2e16f1c262e1b48c4b (diff) | |
| download | caxlsx-af8360755fe21f4e9d30e943ba0b2be3c0128d28.tar.gz caxlsx-af8360755fe21f4e9d30e943ba0b2be3c0128d28.zip | |
Improve boolean validation constants (i.e. Axlsx::VALID_BOOLEAN_VALUES)
Added VALID_BOOLEAN_TRUE_VALUES and VALID_BOOLEAN_FALSE_VALUES so that
those can be re-used in other placed and have the same notion of what
a valid boolean value is. For example, we can use the true values in
`Cell#u=`.
Additionally, since validate_boolean / BOOLEAN_VALIDATOR are invoked
so frequently, putting the likely values at the front can actually
make a non-trivial difference. Since VALID_BOOLEAN_VALUES is derived
from VALID_BOOLEAN_TRUE_VALUES and VALID_BOOLEAN_FALSE_VALUES, we
use `Array#zip` to still end up with good order.
Diffstat (limited to 'lib/axlsx/workbook/worksheet/cell.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 10818f5c..8afacee1 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -291,7 +291,7 @@ module Axlsx # @see u def u=(v) - v = :single if [true, 1, :true, 'true'].include?(v) + v = :single if VALID_BOOLEAN_TRUE_VALUES.include?(v) set_run_style :validate_cell_u, :u, v end |
