Class: Hpricot::Text

Inherits:
BasicNode show all
Includes:
Leaf, Trav
Defined in:
lib/hpricot/tag.rb,
lib/hpricot/nodes.rb,
lib/hpricot/inspect.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

Attributes inherited from BasicNode

#name, #parent

Instance Method Summary collapse

Methods included from Trav

#traverse_text_internal

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 Node

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

Methods included from Hpricot

build, scan, uxs, xchr, xs

Constructor Details

#initialize(content) ⇒ Text

Returns a new instance of Text.



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

def initialize content; self.content = content end

Instance Method Details

#<<(str) ⇒ Object



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

def << str; self.content << str end

#clear_raw ⇒ Object



34
35
36
# File 'lib/hpricot/nodes.rb', line 34

def clear_raw
  self.name = nil
end

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



172
173
174
175
176
177
# File 'lib/hpricot/tag.rb', line 172

def output(out, opts = {})
  out <<
    if_output(opts) do
      content.to_s
    end
end

#pathname ⇒ Object



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

def pathname; "text()" end

#pretty_print(q) ⇒ Object



84
85
86
# File 'lib/hpricot/inspect.rb', line 84

def pretty_print(q)
  q.text content.dump
end

#to_s ⇒ Object Also known as: inner_text, to_plain_text



166
167
168
# File 'lib/hpricot/tag.rb', line 166

def to_s
  Hpricot.uxs(content)
end