lib/osheet/worksheet.rb in osheet-0.5.0 vs lib/osheet/worksheet.rb in osheet-0.6.0

- old
+ new

@@ -5,10 +5,11 @@ class Worksheet include Instance include Associations include WorkbookElement include MetaElement + include MarkupElement hm :columns hm :rows def initialize(workbook=nil, *args, &block) @@ -32,10 +33,13 @@ def sanitized_name(name_value) if get_ivar(:workbook) && get_ivar(:workbook).worksheets.collect{|ws| ws.name}.include?(name_value) raise ArgumentError, "the sheet name '#{name_value}' is already in use. choose a sheet name that is not used by another sheet" end - name_value + if name_value.to_s.length > 31 + raise ArgumentError, "worksheet names must be less than 32 characters long" + end + name_value.to_s end end end