Module: Hpricot::Leaf

Includes:
Node
Included in:
BogusETag, CData, Comment, DocType, ProcIns, Text, XMLDecl
Defined in:
lib/hpricot/inspect.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 Method Summary collapse

Methods included from Node

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

Methods included from Hpricot

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

Instance Method Details

#pretty_print(q) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hpricot/inspect.rb', line 20

def pretty_print(q)
  q.group(1, '{', '}') {
    q.text self.class.name.sub(/.*::/,'').downcase
    if rs = raw_string
      rs.scan(/[^\r\n]*(?:\r\n?|\n|[^\r\n]\z)/) {|line|
        q.breakable
        q.pp line
      }
    elsif self.respond_to? :to_s
      q.breakable
      q.text self.to_s
    end
  }
end