spreadsheet 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb16d4af4c562e6c5b65e459811240184635197c457385670cca8921d67e111e
4
- data.tar.gz: c38bc6a6c1bc31706307d28f50d66ec163a371eeeeecdcbc3a06c48287668bb9
3
+ metadata.gz: ef4b84832d5a9a7616d0948a54c34342df9205b691ef561d24725c33fcb65b27
4
+ data.tar.gz: 29dff00bcafb3b46674a1cbd2f57ee433e27d058e69f4da9a6964cac1961f323
5
5
  SHA512:
6
- metadata.gz: 71450fa0a12bd2ef1667aa106dcbcbc1af8fe54c4e49e0930adf433edcb70a8a38e6e5d4de3c82c912bd3c410cbb03554a1e17cc64c1a803dd0204d96d999989
7
- data.tar.gz: a22de68097078aa164d04f80fd6bbd4cdd0f4bb8125a1cf9e250d1884fb9d2147555c183d787d98439d307f8c3fff2a7252a99559ec5d5ac986b2f40a90f5dd5
6
+ metadata.gz: c924c33e13250366696b1ea4d969559d320e270554d0b691d02874980f01442eaaccbe55fdfb2d00bfc37201e7d0be691091a1de2f72a04ad3cb83f47db0134b
7
+ data.tar.gz: b3526dc452d2f8fc983d0af1a1b531737898d22f03ddf6c9e717fd5eb715444df46f36d9942019751bebaf3c9a1ec825eba7e3bdb7b5ad4dfb83605722de03fa
@@ -3,5 +3,5 @@
3
3
  module Spreadsheet
4
4
  ##
5
5
  # The version of Spreadsheet you are using.
6
- VERSION = '1.2.8'
6
+ VERSION = '1.2.9'
7
7
  end
@@ -49,7 +49,7 @@ module Spreadsheet
49
49
  :right => 0.75,
50
50
  :bottom => 1
51
51
  }
52
- @name = opts[:name] || 'Worksheet'
52
+ @name = sanitize_invalid_characters(opts[:name] || 'Worksheet')
53
53
  @workbook = opts[:workbook]
54
54
  @rows = []
55
55
  @columns = []
@@ -366,6 +366,9 @@ module Spreadsheet
366
366
  end
367
367
 
368
368
  private
369
+ def sanitize_invalid_characters(name) # :nodoc:
370
+ name.gsub(Regexp.new('[\\\/\*\?\:\[\]]'.encode(Spreadsheet.client_encoding)), '_')
371
+ end
369
372
  def index_of_first ary # :nodoc:
370
373
  return unless ary
371
374
  ary.index(ary.find do |elm| elm end)
data/test/worksheet.rb CHANGED
@@ -138,5 +138,10 @@ module Spreadsheet
138
138
  end
139
139
  end
140
140
 
141
+ def test_name
142
+ worksheet = Worksheet.new(name: '\a/b*c?d:e[f]')
143
+ assert_equal '_a_b_c_d_e_f_', worksheet.name
144
+ end
145
+
141
146
  end
142
147
  end
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: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannes F. Wyss, Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole