Class: HTML5::TreeBuilders::REXML::Element
- Inherits:
-
Node
- Object
- Base::Node
- Node
- HTML5::TreeBuilders::REXML::Element
- Defined in:
- lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Node
Attributes inherited from Base::Node
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(value) ⇒ Object
- #cloneNode ⇒ Object
-
#initialize(name) ⇒ Element
constructor
A new instance of Element.
- #printTree(indent = 0) ⇒ Object
Methods inherited from Node
#appendChild, #hasContent, #insertBefore, #insertText, #removeChild
Methods inherited from Base::Node
#appendChild, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren
Constructor Details
#initialize(name) ⇒ Element
Returns a new instance of Element.
65 66 67 |
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb', line 65 def initialize name super name end |
Class Method Details
Instance Method Details
#attributes=(value) ⇒ Object
75 76 77 |
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb', line 75 def attributes= value value.each {|name, value| rxobj.attributes[name] = value} end |
#cloneNode ⇒ Object
69 70 71 72 73 |
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb', line 69 def cloneNode newNode = self.class.new name attributes.each {|name,value| newNode.attributes[name] = value} newNode end |
#printTree(indent = 0) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb', line 79 def printTree indent=0 tree = "\n|#{' ' * indent}<#{name}>" indent += 2 for name, value in attributes next if name == 'xmlns' tree += "\n|#{' ' * indent}#{name}=\"#{value}\"" end for child in childNodes tree += child.printTree(indent) end tree end |