# File lib/cgikit.rb, line 444 def instance( element, app, parent, name, body ) body = '' unless body component = "#{app.component_path}/#{element}/#{element}" ext_element = "cgikit/elements/#{element}" ext_component = "cgikit/components/#{element}/#{element}" paths = [ ext_element, ext_component ] # starndard elements if Object.const_defined? element return Object.const_get(element).new(app,parent,name,body) # components elsif FileTest.exist? "#{component}.rb" require component obj = Object.const_get(element).new(app,parent,name,body) return obj end # check paths for extension components $LOAD_PATH.each { | load_path | paths.each { | path | ext_path = "#{load_path}/#{path}" if FileTest.exist?( "#{ext_path}.rb" ) require path obj = Object.const_get(element).new(app,parent,name,body) obj.path = ext_path return obj else next end } } raise UnknownElementError, "No such '#{element}' element or component." end