Module: HTML5::TreeWalkers

Defined in:
lib/html5/treewalkers.rb,
lib/html5/treewalkers/base.rb,
lib/html5/treewalkers/rexml.rb,
lib/html5/treewalkers/hpricot.rb,
lib/html5/treewalkers/simpletree.rb

Defined Under Namespace

Modules: Hpricot, REXML, SimpleTree, TokenConstructor Classes: Base, NonRecursiveTreeWalker

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object Also known as: get_tree_walker



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/html5/treewalkers.rb', line 7

def [](name)
  case name.to_s.downcase
  when 'simpletree'
    require 'html5/treewalkers/simpletree'
    SimpleTree::TreeWalker
  when 'rexml'
    require 'html5/treewalkers/rexml'
    REXML::TreeWalker
  when 'hpricot'
    require 'html5/treewalkers/hpricot'
    Hpricot::TreeWalker
  else
    raise "Unknown TreeWalker #{name}"
  end
end