Class: DocxEdit::ContentBlock
- Inherits:
-
Object
- Object
- DocxEdit::ContentBlock
- Defined in:
- lib/docxedit/content_block.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(xml, content) ⇒ ContentBlock
constructor
A new instance of ContentBlock.
- #xml ⇒ Object
Constructor Details
#initialize(xml, content) ⇒ ContentBlock
Returns a new instance of ContentBlock.
5 6 7 8 9 |
# File 'lib/docxedit/content_block.rb', line 5 def initialize(xml, content) @xml = xml @content_key = content @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/docxedit/content_block.rb', line 3 def content @content end |
Instance Method Details
#clone ⇒ Object
11 12 13 |
# File 'lib/docxedit/content_block.rb', line 11 def clone result = ContentBlock.new(rclone_xml(@xml), @content_key) end |
#xml ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/docxedit/content_block.rb', line 15 def xml unless(@content_key == @content) @node = REXML::XPath.first(@xml, "//*[text()='#{@content_key}']]") @node.text = @content @content_key = @content end return @xml end |