Module: Hpricot::Leaf

Includes:
Node
Included in:
BogusETag, CData, Comment, DocType, ProcIns, Text, XMLDecl
Defined in:
lib/ext/hpricot/modules.rb,
lib/ext/hpricot/inspect.rb

Defined Under Namespace

Modules: Trav

Constant Summary

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, make, parse, uxs, xchr, xs

Instance Method Details

- (Object) pretty_print(q)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ext/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