Sha256: fba0bf1087c707ea89759debad26550cbd35956708e0054271c12cb944030eff
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
require 'osheet/column' require 'osheet/row' module Osheet class Worksheet include Associations include WorkbookElement include MetaElement hm :columns hm :rows def initialize(workbook=nil, *args, &block) @workbook = workbook @name = nil instance_exec(*args, &block) if block_given? end def name(value=nil) !value.nil? ? @name = sanitized_name(value) : @name end def attributes { :name => @name } end private def sanitized_name(name_value) if @workbook && @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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
osheet-0.4.0 | lib/osheet/worksheet.rb |