Class: HTML5::TreeBuilders::SimpleTree::DocumentType

Inherits:
Node
  • Object
show all
Defined in:
lib/html5/treebuilders/simpletree.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#attributes, #name, #value

Attributes inherited from Base::Node

#childNodes, #flags, #parent

Instance Method Summary collapse

Methods inherited from Node

#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #printTree, #removeChild

Methods inherited from Base::Node

#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren

Constructor Details

#initialize(name) ⇒ DocumentType

Returns a new instance of DocumentType.



127
128
129
130
131
# File 'lib/html5/treebuilders/simpletree.rb', line 127

def initialize name
  super name
  @public_id = nil
  @system_id = nil
end

Instance Attribute Details

#public_idObject

Returns the value of attribute public_id.



121
122
123
# File 'lib/html5/treebuilders/simpletree.rb', line 121

def public_id
  @public_id
end

#system_idObject

Returns the value of attribute system_id.



121
122
123
# File 'lib/html5/treebuilders/simpletree.rb', line 121

def system_id
  @system_id
end

Instance Method Details

#to_sObject



123
124
125
# File 'lib/html5/treebuilders/simpletree.rb', line 123

def to_s
  "<!DOCTYPE #{name}" + ([@public_id, @system_id].any? ? " \"#{@public_id}\" \"#{@system_id}\"" : '') + ">"
end