def load
@doc_map = Hash.new
@filter_map = Hash.new
@factory = DocumentFactory.new
rucy_consts = Hash[*Rucy.constants.map{|n| [n, true] }.flatten]
Dir.foreach(@mod_path) do |rb_name|
path = File.join(@mod_path, rb_name)
if ((File.file? path) && rb_name =~ /\.rb$/) then
loader = SimpleLoader.new
begin
loader.load(path)
for const_name in loader.constants
next if (rucy_consts.include? const_name)
case (const_name)
when /Document$/
@doc_map[const_name] = loader
doc_builder = const_name + 'Builder'
if (loader.const_defined? doc_builder) then
@factory.add_document(loader.const_get(doc_builder).instance)
else
@factory.add_document(loader.const_get(const_name))
end
when /Filter$/
@filter_map[const_name] = loader
filter_builder = const_name + 'Builder'
if (loader.const_defined? filter_builder) then
@factory.add_filter(loader.const_get(filter_builder).instance)
else
@factory.add_filter(loader.const_get(const_name))
end
end
end
rescue StandardError, ScriptError
@load_errors.push([ path, $! ])
end
end
end
nil
end