2007-07-05 00:36:59 +02:00
|
|
|
module HTML5
|
2007-05-30 17:45:52 +02:00
|
|
|
module TreeBuilders
|
2007-05-26 03:52:27 +02:00
|
|
|
|
2007-06-05 23:34:49 +02:00
|
|
|
class << self
|
|
|
|
def [](name)
|
|
|
|
case name.to_s.downcase
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'simpletree' then
|
2007-07-05 00:36:59 +02:00
|
|
|
require 'html5/treebuilders/simpletree'
|
2007-05-30 17:45:52 +02:00
|
|
|
SimpleTree::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'rexml' then
|
2007-07-05 00:36:59 +02:00
|
|
|
require 'html5/treebuilders/rexml'
|
2007-06-05 23:34:49 +02:00
|
|
|
REXML::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
when 'hpricot' then
|
2007-07-05 00:36:59 +02:00
|
|
|
require 'html5/treebuilders/hpricot'
|
2007-05-30 17:45:52 +02:00
|
|
|
Hpricot::TreeBuilder
|
2007-05-26 03:52:27 +02:00
|
|
|
else
|
2007-05-30 17:45:52 +02:00
|
|
|
raise "Unknown TreeBuilder #{name}"
|
2007-06-05 23:34:49 +02:00
|
|
|
end
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
2007-05-26 03:52:27 +02:00
|
|
|
|
2007-08-30 19:19:10 +02:00
|
|
|
alias :get_tree_builder :[]
|
2007-06-05 23:34:49 +02:00
|
|
|
end
|
2007-05-30 17:45:52 +02:00
|
|
|
end
|
2007-05-26 03:52:27 +02:00
|
|
|
end
|