Class: Hpricot::CData

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

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 BasicNode

#name, #parent

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

Methods included from Leaf

#pretty_print

Methods included from Node

#altered!, #html_quote, #if_output, #inspect_tree, #pathname

Methods included from Hpricot

build, scan, uxs, xchr, xs

Constructor Details

#initialize(content) ⇒ CData

Returns a new instance of CData.



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

def initialize content; self.content = content end

Instance Attribute Details

#raw_string ⇒ Object

Prefer the span the scanner recorded; fall back to reconstructing the delimiters for nodes built in Ruby rather than parsed. Reconstruction cannot be correct for an unterminated CDATA section, where the source has no closing "]]>".



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

def raw_string; @raw_string || "<![CDATA[#{content}]]>" end

Instance Method Details

#clear_raw ⇒ Object



69
70
71
# File 'lib/hpricot/nodes.rb', line 69

def clear_raw
  self.raw_string = nil
end

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



190
191
192
193
194
195
# File 'lib/hpricot/tag.rb', line 190

def output(out, opts = {})
  out <<
    if_output(opts) do
      "<![CDATA[#{content}]]>"
    end
end