diff options
| -rw-r--r-- | .travis.yml | 14 | ||||
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | Gemfile | 9 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | axlsx.gemspec | 2 | ||||
| -rw-r--r-- | lib/axlsx/version.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 6 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_cell.rb | 25 |
8 files changed, 40 insertions, 23 deletions
diff --git a/.travis.yml b/.travis.yml index 38a3d013..465df230 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby sudo: required -dist: trusty -group: beta +dist: bionic +group: edge cache: bundler bundler_args: --without profile @@ -19,13 +19,12 @@ matrix: - rvm: 2.5.8 - rvm: 2.6.6 - rvm: 2.7.1 - - rvm: rbx-3 + - rvm: 3.0.0 - rvm: jruby-19mode - rvm: jruby-9.1.17.0 - rvm: ruby-head - rvm: jruby-head allow_failures: - - rvm: rbx-3 - rvm: ruby-head - rvm: jruby-9.1.17.0 - rvm: jruby-head @@ -34,9 +33,4 @@ env: global: - JRUBY_OPTS="-Xcli.debug=true --debug" -# https://github.com/jruby/jruby/wiki/FAQs#why-is-jruby-so-slow-to-install-via-rvm -# https://docs.travis-ci.com/user/installing-dependencies#Installing-Packages-with-the-APT-Addon -addons: - apt: - packages: - - haveged +# https://github.com/jruby/jruby/wiki/FAQs#why-is-jruby-so-slow-to-install-via-rvm
\ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cd16e6e1..2dd0ebbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ CHANGELOG --------- - **Unreleased** + +- **December.7.20**: 3.0.3 + - [PR #62](https://github.com/caxlsx/caxlsx/pull/62) - Fix edge cases in format detection for objects whose string representation made them look like numbers but the object didn’t respond to `#to_i` or `#to_f`. - [PR #56](https://github.com/caxlsx/caxlsx/pull/56) - Add `zip_command` option to `#serialize` for faster serialization of large Excel files by using a zip binary - [PR #54](https://github.com/caxlsx/caxlsx/pull/54) - Fix type detection for floats with out-of-rage exponents - [I #67](https://github.com/caxlsx/caxlsx/issues/67) - Fix regression in worksheet name length enforcement: Some unicode characters were counted incorrectly, so that names that previously worked fine now stopped working. (This was introduced in 3.0.2) @@ -9,11 +9,4 @@ end group :profile do gem 'ruby-prof', :platforms => :ruby -end - -platforms :rbx do - gem 'rubysl' - gem 'rubysl-test-unit' - gem 'racc' - gem 'rubinius-coverage', '~> 2.0' -end +end
\ No newline at end of file @@ -1,5 +1,7 @@ # Caxlsx (Community Continued Version) [](https://travis-ci.com/caxlsx/caxlsx) +[](http://badge.fury.io/rb/caxlsx) ## Notice: Community Axlsx Organization diff --git a/axlsx.gemspec b/axlsx.gemspec index d494782f..3f8a5008 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -24,6 +24,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'yard', "~> 0.9.8" s.add_development_dependency 'kramdown', '~> 2.3' s.add_development_dependency 'timecop', "~> 0.8.1" - s.required_ruby_version = '~> 2.3' + s.required_ruby_version = '>= 2.3' s.require_path = 'lib' end diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index eadd9e54..0731798b 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -1,5 +1,5 @@ module Axlsx # The current version - VERSION = "3.0.2" + VERSION = "3.0.3" end 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 diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index d6f5aeae..3a7c1566 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -120,6 +120,31 @@ class TestCell < Test::Unit::TestCase assert_equal(:iso_8601, @c.send(:cell_type_from_value, '2008-08-30T01:45:36.123+09:00')) end + def test_cell_type_from_value_looks_like_number_but_is_not + mimic_number = Class.new do + def initialize(to_s_value) + @to_s_value = to_s_value + end + + def to_s + @to_s_value + end + end + + number_strings = [ + '1', + '1234567890', + '1.0', + '1e1', + '0', + "1e#{Float::MIN_10_EXP}" + ] + + number_strings.each do |number_string| + assert_equal(@c.send(:cell_type_from_value, mimic_number.new(number_string)), :string) + end + end + def test_cast_value @c.type = :string assert_equal(@c.send(:cast_value, 1.0), "1.0") |
