spreadsheet 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjJhMDIxNjBlNzdiZGI4YWYzMTdkODVjMGRlOTI5ZjdhNGM1ZDAxNA==
4
+ ZDU5YTVlMjhjOGMxMTRjYmI3NmFmZjFhZTJjM2M2OWJhNTA2NmNlZQ==
5
5
  data.tar.gz: !binary |-
6
- NjAzZTBhMmM5OWJiOWRjZDQ0ZGNkNTdhM2JkNWI0NWM0NWExYzM3OA==
6
+ NTQ4OGI0Y2VhNTdiNGNjMzdmYzdiMmJhNDJkNGE3OTRhOTk5MjNmMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDMxZjE5YTllNDlmODlkMGFhZmYzNDZiZjY5ZmMwNTkyODczNTU3ZTcwZTlm
10
- NjQ2MjlkY2QzYjc4MmRkMDY2YjBmN2QzZmU1MDc0MDlhNTQ1YTE4MTJiY2Ew
11
- MTNkOGI0YTlkZDQyMDM1NzAyYzYwNDk0ODZjNWFmYjNiNTAyMDM=
9
+ NmNkOTA1ZDk4MjJjMjRmMzY2YmY5NjAyZGU4OTk4NGJjNzJlZTUyZDBiZjBm
10
+ ZmIwN2Y0ZDQ2YjUyZjI1YjNkMjEwZTU2YjQwZDk1OThiNjVkMzdkODBkNDkw
11
+ MzBmMGE3ODQ4ZTNlY2RkNWQwYzM3NTgxNzgyNzk0NjUzNGM3NjQ=
12
12
  data.tar.gz: !binary |-
13
- YmIzMTE4NzY1NGIwN2E1NDdiOGEyMWFjODU2NTg4ZGI3ZjBjMTljZTZmYTY2
14
- MDIxOGE1ZjcyMTdlNWEwZDVkN2EyMmEzZTc2MjVmY2JkYTgyZGVlNzNiOTAy
15
- NzI2MDE1OTMyMWJlZmNkMTA2Y2ViMjM5NmU5MDFiMTgwNTgxYjQ=
13
+ NmViNzExZjEwMzgxOWE4MzRiZTJmNjdmZTNiNzY2OWQxODliZGQ5N2U1M2Zl
14
+ YTM2MDUwMDZiNTFjNTViZDg0MjI1YmMxMjZiMDg4NzZjZTgyODMzYTZjZDcy
15
+ MzgyNzA2YjllNmE5MmU3ZjAwNThlNzZhNTRjZWM5MmFiNGI2Zjg=
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.9.9 / 28.08.2014
2
+
3
+ Author: PikachuEXE <pikachuexe@gmail.com>
4
+ Date: Wed Aug 27 09:55:41 2014 +0800
5
+
6
+ * Add custom error classes
7
+ * Raise custom error for unknown code page or unsupported encoding
8
+
1
9
  ### 0.9.8 / 19.08.2014
2
10
 
3
11
  Author: PikachuEXE <pikachuexe@gmail.com>
@@ -5,7 +13,6 @@ Date: Tue Aug 19 09:54:30 2014 +0800
5
13
 
6
14
  * Fix Encoding for MRI 2.1.0
7
15
 
8
-
9
16
  ### 0.9.7 / 04.02.2014
10
17
 
11
18
  * Avoid exception when reading text objects
data/lib/spreadsheet.rb CHANGED
@@ -24,6 +24,8 @@
24
24
  # 8006 Zürich
25
25
  ### Switzerland
26
26
 
27
+ require 'spreadsheet/errors'
28
+
27
29
  require 'spreadsheet/excel/workbook'
28
30
  require 'spreadsheet/excel/reader'
29
31
  require 'spreadsheet/excel/rgb'
@@ -43,7 +45,7 @@ module Spreadsheet
43
45
 
44
46
  ##
45
47
  # The version of Spreadsheet you are using.
46
- VERSION = '0.9.8'
48
+ VERSION = '0.9.9'
47
49
 
48
50
  ##
49
51
  # Default client Encoding. Change this value if your application uses a
@@ -71,10 +71,16 @@ class Reader
71
71
  value
72
72
  end
73
73
  def encoding codepage_id
74
- name = CODEPAGES.fetch(codepage_id) {
75
- raise "Unknown Codepage 0x%04x" % codepage_id }
74
+ name = CODEPAGES.fetch(codepage_id) do
75
+ raise Spreadsheet::Errors::UnknownCodepage, "Unknown Codepage 0x%04x" % codepage_id
76
+ end
77
+
76
78
  if RUBY_VERSION >= '1.9'
77
- Encoding.find name
79
+ begin
80
+ Encoding.find name
81
+ rescue ArgumentError
82
+ raise Spreadsheet::Errors::UnsupportedEncoding, "Unsupported encoding with name '#{name}'"
83
+ end
78
84
  else
79
85
  name
80
86
  end
@@ -933,7 +939,7 @@ class Reader
933
939
  set_missing_row_address worksheet, work, pos, len
934
940
  end
935
941
  end
936
- previous = op
942
+ previous = op
937
943
  #previous = op unless op == :continue
938
944
  end
939
945
  end
@@ -273,7 +273,9 @@ class Workbook < Spreadsheet::Writer
273
273
  if RUBY_VERSION >= '1.9' && enc.is_a?(Encoding)
274
274
  enc = enc.name.upcase
275
275
  end
276
- cp = SEGAPEDOC[enc] or raise "Invalid or Unknown Codepage '#{enc}'"
276
+ cp = SEGAPEDOC.fetch(enc) do
277
+ raise Spreadsheet::Errors::UnknownCodepage, "Invalid or Unknown Codepage '#{enc}'"
278
+ end
277
279
  write_op writer, 0x0042, [cp].pack('v')
278
280
  end
279
281
  def write_eof workbook, writer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
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: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole