Class: Hpricot::DocType
- Defined in:
- lib/hpricot/tag.rb,
lib/hpricot/modules.rb,
lib/hpricot/modules.rb
Defined Under Namespace
Modules: Trav
Constant Summary
Constants included from Hpricot
ElementContent, ElementExclusions, ElementInclusions, NamedCharacters, NamedCharactersPattern, OmittedAttrName
Instance Attribute Summary
Attributes inherited from BaseEle
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(target, pubid, sysid) ⇒ DocType
constructor
A new instance of DocType.
- #output(out, opts = {}) ⇒ Object
- #pathname ⇒ Object
Methods included from Leaf::Trav
#traverse_all_element, #traverse_some_element, #traverse_text_internal
Methods included from Traverse
#after, #at, #before, #bogusetag?, #children_of_type, #clean_path, #comment?, #css_path, #doc?, #doctype?, #elem?, filter, #get_subnode, #inner_html, #inner_html=, #inner_text, #next_node, #node_position, #nodes_at, #position, #previous_node, #procins?, #search, #swap, #text?, #to_html, #to_original_html, #to_plain_text, #traverse_element, #traverse_text, #xmldecl?, #xpath
Methods included from Leaf
Methods included from Hpricot
XML, build_node, make, scan
Methods inherited from BaseEle
alterable, #altered!, #html_quote, #if_output
Constructor Details
#initialize(target, pubid, sysid) ⇒ DocType
Returns a new instance of DocType.
174 175 176 |
# File 'lib/hpricot/tag.rb', line 174 def initialize(target, pubid, sysid) @target, @public_id, @system_id = target, pubid, sysid end |
Class Method Details
.parse(root_element_name, attrs, raw_string) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/hpricot/parse.rb', line 239 def DocType.parse(root_element_name, attrs, raw_string) if attrs public_identifier = attrs['public_id'] system_identifier = attrs['system_id'] end root_element_name = root_element_name.downcase result = DocType.new(root_element_name, public_identifier, system_identifier) result.raw_string = raw_string result end |
Instance Method Details
#output(out, opts = {}) ⇒ Object
179 180 181 182 183 184 185 186 |
# File 'lib/hpricot/tag.rb', line 179 def output(out, opts = {}) out << if_output(opts) do "<!DOCTYPE #{@target} " + (@public_id ? "PUBLIC \"#{@public_id}\"" : "SYSTEM") + (@system_id ? " #{html_quote(@system_id)}" : "") + ">" end end |
#pathname ⇒ Object
178 |
# File 'lib/hpricot/tag.rb', line 178 def pathname; "doctype()" end |