Class: Sablon::HTMLConverter::Text

Inherits:
Node
  • Object
show all
Defined in:
lib/sablon/html/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#accept, node_name

Constructor Details

#initialize(string, format) ⇒ Text

Returns a new instance of Text.



147
148
149
150
# File 'lib/sablon/html/ast.rb', line 147

def initialize(string, format)
  @string = string
  @format = format
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



146
147
148
# File 'lib/sablon/html/ast.rb', line 146

def string
  @string
end

Instance Method Details

#inspectObject



156
157
158
# File 'lib/sablon/html/ast.rb', line 156

def inspect
  "<Text{#{@format.inspect}}: #{string}>"
end

#to_docxObject



152
153
154
# File 'lib/sablon/html/ast.rb', line 152

def to_docx
  "<w:r>#{@format.to_docx}<w:t xml:space=\"preserve\">#{normalized_string}</w:t></w:r>"
end