Class: OpenxmlDocxTemplater::TextLine

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

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_text(text) ⇒ Object



37
38
39
# File 'lib/openxml_docx_templater/line.rb', line 37

def escape_text(text)
  text.gsub(/['\\]/, '\\\\\&')
end

#to_bufObject



33
34
35
# File 'lib/openxml_docx_templater/line.rb', line 33

def to_buf
  " _buf << '#{escape_text(@text)}';"
end