xlsxtream 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e0567238c9913e1352c5b997232f15834684050
4
- data.tar.gz: 2148c939d2ea8da99e490daf2065bf4ebbe5e266
3
+ metadata.gz: af09aea4670bc6bea0e57545d023cda25571ed8e
4
+ data.tar.gz: fd8bbcf0d5d53f0ccb951a4f42c3507bf341d2f3
5
5
  SHA512:
6
- metadata.gz: 07a53ebc39c5a16d108c970fd69f9037b2ee52305f9e097613791acad219fe44c6d9b59d666eea2d8e6d4b6320c03d7078c428d5a109abddf5122c080a74ddd6
7
- data.tar.gz: d369b2bdd9aad37c3c48f7a9eed654016784b3f4774f2bfd18ae6cd9b43ced4fb82b8f45add2fdb339f27ec37b86d010215f86e262dc03c177b916b1a74715ea
6
+ metadata.gz: 2f4da6bd0909431125db97e6c7a5f0126d7af9e836e52439a8e81505c135c3aeba5e94e3cd779278cfcefc1d59a6098783b05c7b85df64f9ed41651a28afe7a5
7
+ data.tar.gz: 70d5e4294027c6567c8d22a5a9d72ca8d58019a2b40aeb0ebba6b145f69a1d371f0d5a07aae26d44192207d3970105c211e5aed725ca51c22b7a63979c7a8630
data/README.md CHANGED
@@ -27,9 +27,9 @@ Or install it yourself as:
27
27
  ```ruby
28
28
  # Creates a new workbook and closes it at the end of the block.
29
29
  Xlsxtream::Workbook.open("foo.xlsx") do |xlsx|
30
- xlsx.write_sheet "Sheet1" do |sheet|
31
- # Date, Time, DateTime, Fixnum & Float are properly mapped
32
- sheet << [Date.today, "hello", "world", 42, 3.14159265359]
30
+ xlsx.write_worksheet "Sheet1" do |sheet|
31
+ # Date, Time, DateTime and Numeric are properly mapped
32
+ sheet << [Date.today, "hello", "world", 42, 3.14159265359, 42**13]
33
33
  end
34
34
  end
35
35
 
@@ -5,6 +5,7 @@ module Xlsxtream
5
5
  class RubyZip
6
6
  def initialize(path_or_io)
7
7
  stream = path_or_io.respond_to? :reopen
8
+ path_or_io.binmode if path_or_io.respond_to? :binmode
8
9
  @zos = UnbufferedZipOutputStream.new(path_or_io, stream)
9
10
  end
10
11
 
@@ -17,7 +18,9 @@ module Xlsxtream
17
18
  end
18
19
 
19
20
  def close
20
- @zos.close
21
+ os = @zos.close_buffer
22
+ os.flush if os.respond_to? :flush
23
+ os.close if os.respond_to? :close
21
24
  end
22
25
 
23
26
  # Extend get_compressor to hook our custom deflater.
data/lib/xlsxtream/row.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require "date"
2
3
  require "xlsxtream/xml"
3
4
 
4
5
  module Xlsxtream
@@ -16,7 +17,7 @@ module Xlsxtream
16
17
  cid = "#{column}#@rownum"
17
18
  column.next!
18
19
  xml << case value
19
- when Fixnum, Float
20
+ when Numeric
20
21
  %'<c r="#{cid}" t="n"><v>#{value}</v></c>'
21
22
  when Date, Time, DateTime
22
23
  style = value.is_a?(Date) ? 1 : 2
@@ -1,3 +1,3 @@
1
1
  module Xlsxtream
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlsxtream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Bünemann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-01 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.5.1
130
+ rubygems_version: 2.5.2
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Xlsxtream is a streaming XLSX spreadsheet writer