Module: HTree::Leaf

Includes:
Node
Included in:
BogusETag, Comment, DocType, ProcIns, Text, XMLDecl
Defined in:
lib/htree/inspect.rb,
lib/htree/modules.rb,
lib/htree/raw_string.rb,
lib/htree/extract_text.rb

Defined Under Namespace

Modules: Loc, Trav

Constant Summary

Constants included from HTree

DefaultContext, ElementContent, ElementExclusions, ElementInclusions, EmptyBindingObject, HTMLContext, NamedCharacters, NamedCharactersPattern, OmittedAttrName

Instance Method Summary collapse

Methods included from Node

#display_html, #display_xml, #eliminate_raw_string, #generate_xml_output_code, #make_loc, #raw_string, #subst, #subst_internal, #to_node, #to_rexml

Methods included from HTree

#==, build_node, #check_equality, compile_template, #exact_equal?, #exact_equal_object, expand_template, fix_element, fix_structure_list, frozen_string, #hash, #make_exact_equal_object, #make_usual_equal_object, parse, parse_as, parse_pairs, parse_xml, scan, #usual_equal_object, with_frozen_string_hash

Instance Method Details

#extract_textObject



26
27
28
# File 'lib/htree/extract_text.rb', line 26

def extract_text
  Text.new('')
end

#init_raw_stringObject



43
# File 'lib/htree/raw_string.rb', line 43

def init_raw_string() @raw_string = nil end

#pretty_print(q) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/htree/inspect.rb', line 38

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? :display_xml
      q.breakable
      q.text self.display_xml('')
    end
  }
end

#raw_string=(arg) ⇒ Object



44
# File 'lib/htree/raw_string.rb', line 44

def raw_string=(arg) @raw_string = HTree.frozen_string(arg) end

#raw_string_internal(result) ⇒ Object



45
46
47
48
# File 'lib/htree/raw_string.rb', line 45

def raw_string_internal(result)
  throw :raw_string_tag if !@raw_string
  result << @raw_string
end