Class: Rubyword::Document
- Inherits:
-
Object
- Object
- Rubyword::Document
- Includes:
- Writer
- Defined in:
- lib/rubyword/document.rb
Constant Summary
Constants included from Writer
Instance Attribute Summary collapse
-
#content_types ⇒ Object
Returns the value of attribute content_types.
-
#doc_info ⇒ Object
Returns the value of attribute doc_info.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#header ⇒ Object
Returns the value of attribute header.
-
#images ⇒ Object
Returns the value of attribute images.
-
#init_rid ⇒ Object
Returns the value of attribute init_rid.
-
#relation_rids ⇒ Object
Returns the value of attribute relation_rids.
-
#rels_documents ⇒ Object
Returns the value of attribute rels_documents.
-
#sections ⇒ Object
Returns the value of attribute sections.
-
#toc ⇒ Object
Returns the value of attribute toc.
Class Method Summary collapse
Instance Method Summary collapse
-
#information(options = {}) ⇒ Object
initialize doc information.
-
#initialize(options = {}, &block) ⇒ Document
constructor
A new instance of Document.
- #section(style = nil, &block) ⇒ Object
-
#title_directory(option = {}) ⇒ Object
generate TOC.
Methods included from Writer
#save, #write_header_and_footer
Constructor Details
#initialize(options = {}, &block) ⇒ Document
Returns a new instance of Document.
19 20 21 22 23 24 25 26 |
# File 'lib/rubyword/document.rb', line 19 def initialize(={}, &block) @sections, @toc, @init_rid, @doc_info = [], {}, 7, {} @relation_rids = [] @content_types = [] @rels_documents = [] @images = [] instance_eval(&block) if block_given? end |
Instance Attribute Details
#content_types ⇒ Object
Returns the value of attribute content_types.
7 8 9 |
# File 'lib/rubyword/document.rb', line 7 def content_types @content_types end |
#doc_info ⇒ Object
Returns the value of attribute doc_info.
9 10 11 |
# File 'lib/rubyword/document.rb', line 9 def doc_info @doc_info end |
#footer ⇒ Object
Returns the value of attribute footer.
8 9 10 |
# File 'lib/rubyword/document.rb', line 8 def @footer end |
#header ⇒ Object
Returns the value of attribute header.
8 9 10 |
# File 'lib/rubyword/document.rb', line 8 def header @header end |
#images ⇒ Object
Returns the value of attribute images.
7 8 9 |
# File 'lib/rubyword/document.rb', line 7 def images @images end |
#init_rid ⇒ Object
Returns the value of attribute init_rid.
6 7 8 |
# File 'lib/rubyword/document.rb', line 6 def init_rid @init_rid end |
#relation_rids ⇒ Object
Returns the value of attribute relation_rids.
7 8 9 |
# File 'lib/rubyword/document.rb', line 7 def relation_rids @relation_rids end |
#rels_documents ⇒ Object
Returns the value of attribute rels_documents.
7 8 9 |
# File 'lib/rubyword/document.rb', line 7 def rels_documents @rels_documents end |
#sections ⇒ Object
Returns the value of attribute sections.
6 7 8 |
# File 'lib/rubyword/document.rb', line 6 def sections @sections end |
#toc ⇒ Object
Returns the value of attribute toc.
9 10 11 |
# File 'lib/rubyword/document.rb', line 9 def toc @toc end |
Class Method Details
.generate(filename, options = {}, &block) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rubyword/document.rb', line 12 def self.generate(filename, = {}, &block) rubyword = new(, &block) # module Write to create word document rubyword.save(filename) end |
Instance Method Details
#information(options = {}) ⇒ Object
initialize doc information
36 37 38 |
# File 'lib/rubyword/document.rb', line 36 def information(={}) @doc_info = end |
#section(style = nil, &block) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/rubyword/document.rb', line 28 def section(style=nil, &block) @section = Element::Section.new(@sections.count + 1, style, self) self.sections << @section @section.instance_eval(&block) if block_given? @section end |
#title_directory(option = {}) ⇒ Object
generate TOC
41 42 43 44 |
# File 'lib/rubyword/document.rb', line 41 def title_directory(option= {}) @toc.merge!(open: true) @toc.merge!(option) end |