Class: LibExcel::Document

Inherits:
LibXML::XML::Document
  • Object
show all
Includes:
LibXML
Defined in:
lib/libexcel/document.rb

Overview

The Document class manages the document section of the Excel XML file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Document

Creates the Document object. Calls the super() to get the basics of a XML document. name is the name of the document.



11
12
13
14
15
16
17
# File 'lib/libexcel/document.rb', line 11

def initialize(name)
  super()

  @name = name
  build_document
  build_root
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/libexcel/document.rb', line 7

def name
  @name
end

Instance Method Details

#<<(worksheet) ⇒ Document

Appends a worksheet to a Document. Requires that they worksheet being appended to the document be a Worksheet.

Returns:



23
24
25
26
27
28
# File 'lib/libexcel/document.rb', line 23

def <<(worksheet)
  if not worksheet.is_a? Worksheet
    raise ArgumentError, "Need to have a Excel::Worksheet"
  end
  root << worksheet
end