Class: Hpricot::Text

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

Direct Known Subclasses

CData

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, PREDEFINED, PREDEFINED_U, SELF_CLOSING_TAGS

Instance Attribute Summary

Attributes inherited from BaseEle

#parent, #raw_string

Class Method Summary collapse

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 Hpricot

XML, build, build_node, make, parse, scan, uxs, xchr, xs

Methods inherited from BaseEle

alterable, #altered!, #html_quote, #if_output

Constructor Details

#initialize(text) ⇒ Text

Returns a new instance of Text.



139
140
141
# File 'lib/hpricot/tag.rb', line 139

def initialize(text)
  @content = text
end

Class Method Details

.parse_cdata_content(raw_string) ⇒ Object



239
240
241
242
# File 'lib/hpricot/parse.rb', line 239

def Text.parse_cdata_content(raw_string)
  result = CData.new(raw_string)
  result
end

.parse_cdata_section(content) ⇒ Object



244
245
246
247
# File 'lib/hpricot/parse.rb', line 244

def Text.parse_cdata_section(content)
  result = CData.new(content)
  result
end

.parse_pcdata(raw_string) ⇒ Object



234
235
236
237
# File 'lib/hpricot/parse.rb', line 234

def Text.parse_pcdata(raw_string)
  result = Text.new(raw_string)
  result
end

Instance Method Details

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



149
150
151
152
153
154
# File 'lib/hpricot/tag.rb', line 149

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

#pathnameObject



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

def pathname; "text()" end

#pretty_print(q) ⇒ Object



88
89
90
# File 'lib/hpricot/inspect.rb', line 88

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

#to_sObject Also known as: inner_text, to_plain_text



144
145
146
# File 'lib/hpricot/tag.rb', line 144

def to_s
  Hpricot.uxs(@content)
end