spreadsheet 1.0.1 → 1.0.2

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTU2M2U3OTQ5NzA4ZTAyNWUxOWQxYWJjNzk5YmE0ZTRiODEwMjFjYg==
5
- data.tar.gz: !binary |-
6
- ZGEzOGZhNDliYzA1MzRkY2E2OTc4NmZlNjY5NTZkYjQ4ZDU4NGMyMg==
2
+ SHA1:
3
+ metadata.gz: 8dd4e01552b3bddd3c9feb994e88af5875e23b60
4
+ data.tar.gz: 6528a4cb82ea398bcd313cc16c126d0f5b74159f
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NmE3NDhiNzAzYjAwMjQwZmYxMDhmNWVlMjJhYjA1M2JkZDJlOTZlMTQ1MWZl
10
- NDVkYjI3YTczMjMzZGQxOGM5OTE1M2RiYjk1MGI0MmZkNjZkOWIxZjBiMTVk
11
- M2NiZDBlNmFmZjcxNzVjZDU1ZjdjYTI3MjBhYWEwMzZmYWI0M2Y=
12
- data.tar.gz: !binary |-
13
- OTg1Zjc3YTUyNzdiNTUzZThhYTk2MGJjN2FjZDc5ODAxMmJmNWE2ZTYyYWNk
14
- ZDRhMGNlODVlOTJhNmY3MWUyNTJkOTY5OTFmOWI0Y2JhYmY0ODQyYmU0NjFk
15
- OWI3ZjdiOTFjZDU5NzdiN2NhMjM1N2U5NjM0N2M2NmFiNDU0MGE=
6
+ metadata.gz: 9ab820460572fa4541ae850e1e51d05fde74a19d7c6418658a2571133c8ff2b74c2e135bfb3737ee04f368becbb441c2e58e9d7fb6e8b8d790a645d6a4d03508
7
+ data.tar.gz: 51982264c173fe371ec25d39c0641cad022e5ccde66350ee6cdb33bc9eba44fc08809f577755e2949b88d9deae8a1975ea76a55a225a8354f4a1195aa84e6f1f
data/GUIDE.md CHANGED
@@ -279,6 +279,15 @@ book.write "out.xls"
279
279
  Notes
280
280
  * The outline_level should be under 8, which is due to the Excel data format.
281
281
 
282
+ ## Allow access to rendered output instead of just writing a file
283
+
284
+ ```ruby
285
+ file_contents = StringIO.new
286
+ book.write file_contents # => Now file_contents contains the rendered file output
287
+ ```
288
+
289
+ Also see: https://github.com/zdavatz/spreadsheet/issues/125#issuecomment-75541041
290
+
282
291
  ## More about Encodings
283
292
  Spreadsheet assumes it's running on Ruby 1.8 with Iconv-support. It is your
284
293
  responsibility to handle Conversion Errors, or to prevent them e.g. by using
data/History.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 1.0.2 / 05.03.2015
2
+
3
+ Author: cantin <cantin2010@gmail.com>
4
+ Date: Thu Mar 5 16:13:59 2015 +0800
5
+
6
+ * add Rational support
7
+ * add rational requirement
8
+ * use old rational syntax in test
9
+
1
10
  ### 1.0.1 / 22.01.2015
2
11
 
3
12
  Author: Sergey Konotopov <lalalalalala@gmail.com>
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Spreadsheet
2
2
 
3
+ ## Getting Started
3
4
  [![Build Status](https://secure.travis-ci.org/zdavatz/spreadsheet.png)](http://travis-ci.org/zdavatz/spreadsheet)
4
5
 
5
6
  https://github.com/zdavatz/spreadsheet
data/lib/spreadsheet.rb CHANGED
@@ -45,7 +45,7 @@ module Spreadsheet
45
45
 
46
46
  ##
47
47
  # The version of Spreadsheet you are using.
48
- VERSION = '1.0.1'
48
+ VERSION = '1.0.2'
49
49
 
50
50
  ##
51
51
  # Default client Encoding. Change this value if your application uses a
@@ -3,6 +3,7 @@ require 'spreadsheet/excel/writer/biff8'
3
3
  require 'spreadsheet/excel/internals'
4
4
  require 'spreadsheet/excel/internals/biff8'
5
5
  require 'bigdecimal'
6
+ require 'rational' #for Ruby 1.8.x
6
7
 
7
8
  module Spreadsheet
8
9
  module Excel
@@ -64,7 +65,7 @@ class Worksheet
64
65
  cent = 0
65
66
  int = 2
66
67
  higher = value * 100
67
- if (higher.is_a?(BigDecimal) or higher.is_a?(Float)) && higher < 0xfffffffc
68
+ if (higher.is_a?(Rational) or higher.is_a?(BigDecimal) or higher.is_a?(Float)) && higher < 0xfffffffc
68
69
  cent = 1
69
70
  if higher == higher.to_i
70
71
  value = higher.to_i
@@ -90,7 +91,7 @@ class Worksheet
90
91
  def need_number? cell
91
92
  if cell.is_a?(Numeric) && cell.abs > 0x1fffffff
92
93
  true
93
- elsif (cell.is_a?(BigDecimal) or cell.is_a?(Float)) and not cell.nan?
94
+ elsif cell.is_a?(Rational) or ((cell.is_a?(BigDecimal) or cell.is_a?(Float)) and not cell.nan?)
94
95
  higher = cell * 100
95
96
  if higher == higher.to_i
96
97
  need_number? higher.to_i
data/test/integration.rb CHANGED
@@ -1138,6 +1138,36 @@ module Spreadsheet
1138
1138
  assert_equal date1, sheet.row(0).date(0)
1139
1139
  assert_equal datetime1, sheet.row(1).datetime(0)
1140
1140
  end
1141
+
1142
+ def test_rational
1143
+ r1 = Rational(0x1fffffff + 1)
1144
+ r2 = Rational(0xfffffffc + 1)
1145
+ r3 = Rational(20, 3)
1146
+ r4 = Rational(1238237, 378122)
1147
+ r5 = Rational(200)
1148
+ r6 = Rational(1012, 100)
1149
+
1150
+ book = Spreadsheet::Workbook.new
1151
+ sheet = book.create_worksheet
1152
+ sheet.insert_row 0, [r1, r2, r3]
1153
+ sheet.insert_row 1, [r4, r5, r6]
1154
+
1155
+ path = File.join @var, 'test_rational.xls'
1156
+ book.write path
1157
+
1158
+ assert_nothing_raised do
1159
+ book = Spreadsheet.open path
1160
+ end
1161
+
1162
+ sheet = book.worksheet(0)
1163
+ assert_equal r1, sheet[0, 0]
1164
+ assert_equal r2, sheet[0, 1]
1165
+ assert_equal r3, sheet[0, 2]
1166
+ assert_equal r4, sheet[1, 0]
1167
+ assert_equal r5, sheet[1, 1]
1168
+ assert_equal r6, sheet[1, 2]
1169
+ end
1170
+
1141
1171
  def test_sharedfmla
1142
1172
  path = File.join @data, 'test_formula.xls'
1143
1173
  book = Spreadsheet.open path
metadata CHANGED
@@ -1,70 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.10'
33
+ version: '4.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.10'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hoe
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.13'
47
+ version: '3.7'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.13'
55
- description: ''
54
+ version: '3.7'
55
+ description: |-
56
+ The Spreadsheet Library is designed to read and write Spreadsheet Documents.
57
+ As of version 0.6.0, only Microsoft Excel compatible spreadsheets are
58
+ supported. Spreadsheet is a combination/complete rewrite of the
59
+ Spreadsheet::Excel Library by Daniel J. Berger and the ParseExcel Library by
60
+ Hannes Wyss. Spreadsheet can read, write and modify Spreadsheet Documents.
56
61
  email:
57
62
  - mhatakeyama@ywesee.com, zdavatz@ywesee.com
58
63
  executables:
59
64
  - xlsopcodes
60
65
  extensions: []
61
66
  extra_rdoc_files:
67
+ - GUIDE.md
68
+ - History.md
62
69
  - LICENSE.txt
63
70
  - Manifest.txt
71
+ - README.md
64
72
  files:
65
- - .gemtest
66
- - .gitignore
67
- - .travis.yml
73
+ - ".gemtest"
74
+ - ".gitignore"
75
+ - ".travis.yml"
68
76
  - Excel97-2007BinaryFileFormatSpecification.pdf
69
77
  - GUIDE.md
70
78
  - Gemfile
@@ -151,28 +159,29 @@ files:
151
159
  - test/workbook_protection.rb
152
160
  - test/worksheet.rb
153
161
  homepage:
154
- licenses: []
162
+ licenses:
163
+ - MIT
155
164
  metadata: {}
156
165
  post_install_message:
157
166
  rdoc_options:
158
- - --main
159
- - README.txt
167
+ - "--main"
168
+ - README.md
160
169
  require_paths:
161
170
  - lib
162
171
  required_ruby_version: !ruby/object:Gem::Requirement
163
172
  requirements:
164
- - - ! '>='
173
+ - - ">="
165
174
  - !ruby/object:Gem::Version
166
175
  version: '0'
167
176
  required_rubygems_version: !ruby/object:Gem::Requirement
168
177
  requirements:
169
- - - ! '>='
178
+ - - ">="
170
179
  - !ruby/object:Gem::Version
171
180
  version: '0'
172
181
  requirements: []
173
182
  rubyforge_project: spreadsheet
174
- rubygems_version: 2.3.0
183
+ rubygems_version: 2.4.5
175
184
  signing_key:
176
185
  specification_version: 4
177
- summary: ''
186
+ summary: The Spreadsheet Library is designed to read and write Spreadsheet Documents
178
187
  test_files: []