Class: Hpricot::ProcIns

Inherits:
AttrNode show all
Includes:
Leaf, Trav
Defined in:
lib/hpricot/nodes.rb,
lib/hpricot/tag.rb,
lib/hpricot/modules.rb,
lib/hpricot/modules.rb

Overview

Like Comment and CData, ProcIns carries a raw_string the C extension did not have. Its #content holds only the text after the target, so preserve mode had to reconstruct "" -- which does not reproduce <?x?> (no space), <?x> (no ? terminator), or any PI whose internal whitespace is not a single space, <?php echo 1; ?> included.

Defined Under Namespace

Modules: Trav

Constant Summary

Constants included from Hpricot

AttrCore, AttrEvents, AttrFocus, AttrHAlign, AttrI18n, AttrVAlign, Attrs, ElementContent, ElementExclusions, ElementInclusions, FORM_TAGS, NamedCharacters, NamedCharactersPattern, OmittedAttrName, SELF_CLOSING_TAGS

Instance Attribute Summary collapse

Attributes inherited from AttrNode

#name, #parent, #raw_attributes

Instance Method Summary collapse

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, #following, #get_subnode, #html, #index, #inner_html=, #inner_text, #make, #next, #node_position, #nodes_at, #position, #preceding, #previous, #procins?, #search, #swap, #text?, #to_html, #to_original_html, #to_plain_text, #traverse_element, #traverse_text, #xmldecl?, #xpath

Methods included from Leaf

#pretty_print

Methods included from Node

#altered!, #clear_raw, #html_quote, #if_output, #inspect_tree

Methods included from Hpricot

build, scan, uxs, xchr, xs

Instance Attribute Details

#raw_string ⇒ Object

The recorded span wins; reconstructing cannot reproduce a PI's original spacing or a missing ? terminator. Falls back to output for a ProcIns built in Ruby rather than parsed.



232
# File 'lib/hpricot/tag.rb', line 232

def raw_string; @raw_string || output(+"") end

Instance Method Details

#output(out, opts = {}) ⇒ Object



233
234
235
236
237
238
239
240
# File 'lib/hpricot/tag.rb', line 233

def output(out, opts = {})
  out <<
    if_output(opts) do
      "<?#{target}" +
       (content ? " #{content}" : "") +
       "?>"
    end
end

#pathname ⇒ Object



227
# File 'lib/hpricot/tag.rb', line 227

def pathname; "procins()" end