Module: HTML5::TreeBuilders

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

Defined Under Namespace

Modules: Base, Hpricot, REXML, SimpleTree

Class Method Summary collapse

Class Method Details

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



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/html5/treebuilders.rb', line 5

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