diff options
| author | Toms Mikoss <[email protected]> | 2020-09-17 10:16:08 +0300 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2020-12-03 23:33:17 +0100 |
| commit | 07f97cb90d59e77d74773851a22a7dd4a8115145 (patch) | |
| tree | d0b28252cc19d500749c5aed7c8d488ae08693ca /lib | |
| parent | e4aeec68c8b7bb699db876df375a1e98187b21ac (diff) | |
| download | caxlsx-07f97cb90d59e77d74773851a22a7dd4a8115145.tar.gz caxlsx-07f97cb90d59e77d74773851a22a7dd4a8115145.zip | |
Extend cell_type_from_value with sanity checks
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index a066ba91..a11bddfd 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -451,11 +451,11 @@ module Axlsx :time elsif v.is_a?(TrueClass) || v.is_a?(FalseClass) :boolean - elsif v.to_s =~ Axlsx::NUMERIC_REGEX + elsif v.to_s =~ Axlsx::NUMERIC_REGEX && v.respond_to?(:to_i) :integer - elsif v.to_s =~ Axlsx::SAFE_FLOAT_REGEX + elsif v.to_s =~ Axlsx::SAFE_FLOAT_REGEX && v.respond_to?(:to_f) :float - elsif (matchdata = v.to_s.match(MAYBE_FLOAT_REGEX)) && (Float::MIN_10_EXP..Float::MAX_10_EXP).cover?(matchdata[:exp].to_i) + elsif (matchdata = v.to_s.match(MAYBE_FLOAT_REGEX)) && (Float::MIN_10_EXP..Float::MAX_10_EXP).cover?(matchdata[:exp].to_i) && v.respond_to?(:to_f) :float elsif v.to_s =~ Axlsx::ISO_8601_REGEX :iso_8601 |
