saxlsx 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da2ce81245e5789f61d744d62b959ebf6f42102c
4
- data.tar.gz: ea8fc650ffb52f4f2928a35a40d3978babbc5453
3
+ metadata.gz: 850d7678a428facb3540f2ede647e9c86abd370b
4
+ data.tar.gz: 3115277cae3bd74a25d25d9079ae7c1187663d07
5
5
  SHA512:
6
- metadata.gz: 51437661a84eca9d1023b582a13a9f32fe658e42fc9c72d3b5b119185c730e57db3337d6d45f296351ea8fada0558729b17828b854149e2da6b580796085eb68
7
- data.tar.gz: 7030c2fbd6c6729321ba9ba6ebf6847989155bafecaefdd79acb6c53fefdcdd2bb55d1b9ad0febf2efd44db7ab36159e75e5b39196d082d74d9b533f26c26590
6
+ metadata.gz: d1bd7ce2c41e5004cac2f04a65164358082b53b24c7d536534e999815ce9c3cf1360d40b92e738c0b31b28b89a0ef6bc263b15a5c188475af80cfaeaae321ef1
7
+ data.tar.gz: 4cb3aaab6197f53c6c90fb025c6322091b6b3febaf4d57a2168cc451a04328310f525967e92665855c99bf56079e33ad9add5a6cbac3edc8765a4ac0a000ca57
@@ -1,6 +1,6 @@
1
1
  module Saxlsx
2
2
  class RowsCollectionParser < Ox::Sax
3
- SECONDS_IN_DAY = BigDecimal.new(86400)
3
+ SECONDS_IN_DAY = 86400
4
4
  NUM_FORMATS = {
5
5
  0 => :string, # General
6
6
  1 => :fixnum, # 0
@@ -106,7 +106,7 @@ module Saxlsx
106
106
  @base_date + text.to_i
107
107
  when :date_time
108
108
  # Round time to seconds
109
- date = @base_date + (BigDecimal.new(text) * SECONDS_IN_DAY).round / SECONDS_IN_DAY
109
+ date = @base_date + Rational((text.to_f * SECONDS_IN_DAY).round, SECONDS_IN_DAY)
110
110
  DateTime.new(date.year, date.month, date.day, date.hour, date.minute, date.second)
111
111
  when :fixnum
112
112
  text.to_i
@@ -1,3 +1,3 @@
1
1
  module Saxlsx
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
data/lib/saxlsx.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'bigdecimal'
2
+ require 'rational'
1
3
  require 'zip'
2
4
  require 'ox'
3
5
  require 'cgi'
data/spec/data/Spec.xlsx CHANGED
Binary file
data/spec/sheet_spec.rb CHANGED
@@ -35,7 +35,8 @@ describe Sheet do
35
35
  3,
36
36
  DateTime.new(2013, 12, 13, 8, 0, 58),
37
37
  DateTime.new(1970, 1, 1),
38
- BigDecimal.new('3.4028236692093801E+38')
38
+ BigDecimal.new('3.4028236692093801E+38'),
39
+ DateTime.new(2015, 2, 13, 12, 40, 5)
39
40
  ]
40
41
  s.rows[1].should eq [
41
42
  'Case sensitive',
@@ -80,7 +81,7 @@ describe Sheet do
80
81
  w.sheets[0].to_csv tmp_path
81
82
 
82
83
  csv = File.open(csv_file, 'r') { |f| f.readlines }
83
- csv[0].should eq %{"LevenshteinDistance","3.14","3","2013-12-13T08:00:58+00:00","1970-01-01T00:00:00+00:00","0.34028236692093801E39"\n}
84
+ csv[0].should eq %{"LevenshteinDistance","3.14","3","2013-12-13T08:00:58+00:00","1970-01-01T00:00:00+00:00","0.34028236692093801E39","2015-02-13T12:40:05+00:00"\n}
84
85
  csv[1].should eq %{"Case sensitive","false","3.0","1970-01-01T01:00:00+00:00"\n}
85
86
  csv[2].should eq "\"Fields\",\"Type\",\"URL Mining\"\n"
86
87
  csv[3].should eq "\"autor\",\"text\",\"false\"\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saxlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgars Beigarts
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.2.2
155
+ rubygems_version: 2.4.6
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Fast xlsx reader on top of Ox SAX parser