Class: Docxi::Word::Contents::TableOfContent
- Inherits:
-
Object
- Object
- Docxi::Word::Contents::TableOfContent
- Defined in:
- lib/docxi/word/contents/table_of_content.rb
Defined Under Namespace
Classes: Row
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #add_row(text, page = nil, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ TableOfContent
constructor
A new instance of TableOfContent.
- #render(xml) ⇒ Object
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 = @rows = [] if block_given? yield self else end end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/docxi/word/contents/table_of_content.rb', line 7 def @options end |
#rows ⇒ Object
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, ={}) row = Row.new(text, page, ) @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 |