spreadsheet 0.6.5.8 → 0.6.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +1 -0
- data/lib/spreadsheet.rb +1 -1
- data/lib/spreadsheet/encodings.rb +11 -0
- data/test/excel/writer/workbook.rb +23 -0
- data/test/excel/writer/worksheet.rb +1 -1
- data/test/integration.rb +14 -2
- data/test/worksheet.rb +1 -1
- metadata +5 -4
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 0.6.5.9 / 7.9.2011
|
2
|
+
|
3
|
+
* Fixed a frozen string bug thanks to dblock (Daniel Doubrovkine),
|
4
|
+
* dblock@dblock.org
|
5
|
+
|
6
|
+
* https://github.com/dblock/spreadsheet/commit/164dcfbb24097728f1a7453702c270107e725b7c
|
7
|
+
|
1
8
|
=== 0.6.5.8 / 30.8.2011
|
2
9
|
|
3
10
|
* This patch is about adding a sheet_count method to workbook so that it returns
|
data/Manifest.txt
CHANGED
data/lib/spreadsheet.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# Spreadsheet::Encoding -- spreadheet -- 07.09.2011 -- mhatakeyama@ywesee.com
|
4
|
+
# Spreadsheet::Encoding -- spreadheet -- 03.07.2009 -- hwyss@ywesee.com
|
5
|
+
|
1
6
|
module Spreadsheet
|
2
7
|
##
|
3
8
|
# Methods for Encoding-conversions. You should not need to use any of these.
|
4
9
|
module Encodings
|
5
10
|
if RUBY_VERSION >= '1.9'
|
6
11
|
def client string, internal='UTF-16LE'
|
12
|
+
string = string.dup
|
7
13
|
string.force_encoding internal
|
8
14
|
string.encode Spreadsheet.client_encoding
|
9
15
|
end
|
10
16
|
def internal string, client=Spreadsheet.client_encoding
|
17
|
+
string = string.dup
|
11
18
|
string.force_encoding client
|
12
19
|
string.encode('UTF-16LE').force_encoding('ASCII-8BIT')
|
13
20
|
end
|
14
21
|
def utf8 string, client=Spreadsheet.client_encoding
|
22
|
+
string = string.dup
|
15
23
|
string.force_encoding client
|
16
24
|
string.encode('UTF-8')
|
17
25
|
end
|
@@ -19,16 +27,19 @@ module Spreadsheet
|
|
19
27
|
require 'iconv'
|
20
28
|
@@iconvs = {}
|
21
29
|
def client string, internal='UTF-16LE'
|
30
|
+
string = string.dup
|
22
31
|
key = [Spreadsheet.client_encoding, internal]
|
23
32
|
iconv = @@iconvs[key] ||= Iconv.new(Spreadsheet.client_encoding, internal)
|
24
33
|
iconv.iconv string
|
25
34
|
end
|
26
35
|
def internal string, client=Spreadsheet.client_encoding
|
36
|
+
string = string.dup
|
27
37
|
key = ['UTF-16LE', client]
|
28
38
|
iconv = @@iconvs[key] ||= Iconv.new('UTF-16LE', client)
|
29
39
|
iconv.iconv string
|
30
40
|
end
|
31
41
|
def utf8 string, client=Spreadsheet.client_encoding
|
42
|
+
string = string.dup
|
32
43
|
key = ['UTF-8', client]
|
33
44
|
iconv = @@iconvs[key] ||= Iconv.new('UTF-8', client)
|
34
45
|
iconv.iconv string
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Excel::Writer::TestWorkbook -- Spreadsheet -- 20.07.2011 -- vanderhoorn@gmail.com
|
3
|
+
|
4
|
+
$: << File.expand_path('../../../lib', File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'spreadsheet'
|
8
|
+
|
9
|
+
module Spreadsheet
|
10
|
+
module Excel
|
11
|
+
module Writer
|
12
|
+
class TestWorkbook < Test::Unit::TestCase
|
13
|
+
def test_sanitize_worksheets
|
14
|
+
book = Spreadsheet::Excel::Workbook.new
|
15
|
+
assert_instance_of Excel::Workbook, book
|
16
|
+
assert_equal book.worksheets.size, 0
|
17
|
+
workbook_writer = Excel::Writer::Workbook.new book
|
18
|
+
assert_nothing_raised { workbook_writer.sanitize_worksheets book.worksheets }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/test/integration.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
-
# TestIntegration --
|
3
|
+
# TestIntegration -- spreadheet -- 07.09.2011 -- mhatakeyama@ywesee.com
|
4
|
+
# TestIntegration -- spreadheet -- 08.10.2007 -- hwyss@ywesee.com
|
4
5
|
|
5
6
|
$: << File.expand_path('../lib', File.dirname(__FILE__))
|
6
7
|
|
@@ -1294,6 +1295,17 @@ module Spreadsheet
|
|
1294
1295
|
end
|
1295
1296
|
end
|
1296
1297
|
=end
|
1298
|
+
def test_write_frozen_string
|
1299
|
+
Spreadsheet.client_encoding = 'UTF-16LE'
|
1300
|
+
book = Spreadsheet::Workbook.new
|
1301
|
+
path = File.join @var, 'test_write_workbook.xls'
|
1302
|
+
sheet1 = book.create_worksheet
|
1303
|
+
str1 = "Frozen String.".freeze
|
1304
|
+
sheet1[0,0] = str1
|
1305
|
+
sheet1.row(0).push str1
|
1306
|
+
assert_nothing_raised do
|
1307
|
+
book.write path
|
1308
|
+
end
|
1309
|
+
end
|
1297
1310
|
end
|
1298
1311
|
end
|
1299
|
-
|
data/test/worksheet.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 121
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
9
|
- 5
|
10
|
-
-
|
11
|
-
version: 0.6.5.
|
10
|
+
- 9
|
11
|
+
version: 0.6.5.9
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-09-07 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- test/data/test_version_excel95.xls
|
124
124
|
- test/data/test_version_excel97.xls
|
125
125
|
- test/excel/row.rb
|
126
|
+
- test/excel/writer/workbook.rb
|
126
127
|
- test/excel/writer/worksheet.rb
|
127
128
|
- test/font.rb
|
128
129
|
- test/integration.rb
|