diff options
| author | Randy Morgan <[email protected]> | 2013-01-10 18:27:54 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-01-10 18:27:54 +0900 |
| commit | 41fec1cf9993d351eb5d5961930789b36fe66316 (patch) | |
| tree | ea5a2c75a57318ef1afa43aed8017c5c38e9fcb8 /lib | |
| parent | cb73d9c5072c48ddc5b481dcf68e89fa5f8ae7a4 (diff) | |
| parent | a912d34ee779bd50942cc8d5fc6d684eb45dbdb6 (diff) | |
| download | caxlsx-41fec1cf9993d351eb5d5961930789b36fe66316.tar.gz caxlsx-41fec1cf9993d351eb5d5961930789b36fe66316.zip | |
Merge branch 'master' of https://github.com/randym/axlsx
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 26385573..5f650263 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -23,11 +23,11 @@ module Axlsx # @option options [Boolean] show_gridlines indicates if gridlines should be shown for this sheet. def initialize(wb, options={}) self.workbook = wb - @workbook.worksheets << self @sheet_protection = nil initialize_page_options(options) parse_options options + @workbook.worksheets << self end # Initalizes page margin, setup and print options @@ -637,14 +637,14 @@ module Axlsx end sheet_view.show_outline_symbols = true end - end + def validate_sheet_name(name) DataTypeValidator.validate "Worksheet.name", String, name raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if name.size > 31 raise ArgumentError, (ERR_SHEET_NAME_CHARACTER_FORBIDDEN % name) if '[]*/\?:'.chars.any? { |char| name.include? char } name = Axlsx::coder.encode(name) - sheet_names = @workbook.worksheets.map { |s| s.name } + sheet_names = @workbook.worksheets.reject { |s| s == self }.map { |s| s.name } raise ArgumentError, (ERR_DUPLICATE_SHEET_NAME % name) if sheet_names.include?(name) end |
