Class: Docxi::Word::Contents::TableOfContent

Inherits:
Object
  • Object
show all
Defined in:
lib/docxi/word/contents/table_of_content.rb

Defined Under Namespace

Classes: Row

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ TableOfContent

Returns a new instance of TableOfContent.



8
9
10
11
12
13
14
15
16
17
# File 'lib/docxi/word/contents/table_of_content.rb', line 8

def initialize(options={})
  @options = options
  @rows = []

  if block_given?
    yield self
  else

  end
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/docxi/word/contents/table_of_content.rb', line 7

def options
  @options
end

#rowsObject

Returns the value of attribute rows.



7
8
9
# File 'lib/docxi/word/contents/table_of_content.rb', line 7

def rows
  @rows
end

Instance Method Details

#add_row(text, page = nil, options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/docxi/word/contents/table_of_content.rb', line 19

def add_row(text, page=nil, options={})
  row = Row.new(text, page, options)
  @rows << row
  row
end

#render(xml) ⇒ Object



25
26
27
28
29
# File 'lib/docxi/word/contents/table_of_content.rb', line 25

def render(xml)
  @rows.each do |row|
    row.render(xml)
  end
end