Class: Docx::DocumentReplacer
- Inherits:
-
Object
- Object
- Docx::DocumentReplacer
- Defined in:
- lib/docx/document_replacer.rb
Instance Attribute Summary collapse
-
#observer ⇒ Object
readonly
Returns the value of attribute observer.
Instance Method Summary collapse
-
#initialize(str, data_provider, opts = {}) ⇒ DocumentReplacer
constructor
A new instance of DocumentReplacer.
- #replaced ⇒ Object
Constructor Details
#initialize(str, data_provider, opts = {}) ⇒ DocumentReplacer
Returns a new instance of DocumentReplacer.
9 10 11 12 13 14 15 |
# File 'lib/docx/document_replacer.rb', line 9 def initialize(str, data_provider, opts = {}) @doc = REXML::Document.new(str) @observer = Docx::PlaceholderObserver.new(data_provider) walk_node(doc.root) @observer.end_of_document convert_newlines if opts.fetch(:convert_newlines){ true } end |
Instance Attribute Details
#observer ⇒ Object (readonly)
Returns the value of attribute observer.
7 8 9 |
# File 'lib/docx/document_replacer.rb', line 7 def observer @observer end |
Instance Method Details
#replaced ⇒ Object
17 18 19 |
# File 'lib/docx/document_replacer.rb', line 17 def replaced doc.to_s end |