Class: HTML5::TreeBuilders::Hpricot::DocumentType
- Inherits:
-
Node
- Object
- Base::Node
- Node
- HTML5::TreeBuilders::Hpricot::DocumentType
- Defined in:
- lib/html5/treebuilders/hpricot.rb
Instance Attribute Summary
Attributes inherited from Node
Attributes inherited from Base::Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, public_id, system_id) ⇒ DocumentType
constructor
A new instance of DocumentType.
- #printTree(indent = 0) ⇒ Object
Methods inherited from Node
#appendChild, #hasContent, #insertBefore, #insertText, #removeChild
Methods inherited from Base::Node
#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren
Constructor Details
#initialize(name, public_id, system_id) ⇒ DocumentType
Returns a new instance of DocumentType.
156 157 158 |
# File 'lib/html5/treebuilders/hpricot.rb', line 156 def initialize(name, public_id, system_id) @hpricot = self.class.hpricot_class.new(name, public_id, system_id) end |
Class Method Details
.hpricot_class ⇒ Object
152 153 154 |
# File 'lib/html5/treebuilders/hpricot.rb', line 152 def self.hpricot_class ::Hpricot::DocType end |
Instance Method Details
#printTree(indent = 0) ⇒ Object
160 161 162 163 164 165 166 167 168 |
# File 'lib/html5/treebuilders/hpricot.rb', line 160 def printTree(indent=0) if hpricot.target and hpricot.target.any? "\n|#{' ' * indent}<!DOCTYPE #{hpricot.target}" + ([hpricot.public_id, hpricot.system_id].any? ? " \"#{hpricot.public_id}\" \"#{hpricot.system_id}\"" : '') + '>' else "\n|#{' ' * indent}<!DOCTYPE >" end end |