Class: OpenxmlDocxTemplater::CodeLine

Inherits:
Line
  • Object
show all
Defined in:
lib/openxml_docx_templater/line.rb

Direct Known Subclasses

LiteralLine, StringLine

Instance Attribute Summary

Attributes inherited from Line

#text

Instance Method Summary collapse

Methods inherited from Line

code, #initialize, literal, string, text, #to_s

Constructor Details

This class inherits a constructor from OpenxmlDocxTemplater::Line

Instance Method Details

#escape_code(code) ⇒ Object



47
48
49
# File 'lib/openxml_docx_templater/line.rb', line 47

def escape_code(code)
  code.mgsub(/&apos;/ => "'", /&gt;/ => '>', /&lt/ => '<', /&quot;/ => '"', /&amp;/ => '&')
end

#to_bufObject



43
44
45
# File 'lib/openxml_docx_templater/line.rb', line 43

def to_buf
  "#{escape_code(@text)};"
end