Class: Wunderbar::TextNode
Direct Known Subclasses
Constant Summary
Constants inherited from Node
Instance Attribute Summary
Attributes inherited from Node
#attrs, #children, #name, #node, #parent, #text
Instance Method Summary collapse
-
#initialize(*args) ⇒ TextNode
constructor
A new instance of TextNode.
- #serialize(options, result, indent) ⇒ Object
Methods inherited from Node
#add_child, #at, #method_missing, parse_css_selector, #preserve_spaces?, #root, #search, #walk
Constructor Details
#initialize(*args) ⇒ TextNode
Returns a new instance of TextNode.
308 309 310 |
# File 'lib/wunderbar/node.rb', line 308 def initialize(*args) super(nil, *args) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wunderbar::Node
Instance Method Details
#serialize(options, result, indent) ⇒ Object
312 313 314 315 316 317 318 |
# File 'lib/wunderbar/node.rb', line 312 def serialize(, result, indent) if [:space] == :preserve result << @text.to_s.gsub(/[&<>\u00A0]/,ESCAPE) else result << @text.to_s.gsub(/[&<>\u00A0]/,ESCAPE).gsub(/\s+/, ' ') end end |