xlsxtream 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/xlsxtream/io/rubyzip.rb +4 -1
- data/lib/xlsxtream/row.rb +2 -1
- data/lib/xlsxtream/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af09aea4670bc6bea0e57545d023cda25571ed8e
|
4
|
+
data.tar.gz: fd8bbcf0d5d53f0ccb951a4f42c3507bf341d2f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
31
|
-
# Date, Time, DateTime
|
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
|
|
data/lib/xlsxtream/io/rubyzip.rb
CHANGED
@@ -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.
|
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
|
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
|
data/lib/xlsxtream/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|