require 'janis/proxy_website_parser' Dir[File.dirname(__FILE__) + '/specific_parsers/*.rb'].each { |file| require file } module Janis module Parsing class ParserFactory def self.create_parser_for(url) parsers = Janis::Parsing::SpecificParsers::ProxyWebsiteParser.subclasses raise "No parsers available!" if parsers.empty? parser_class = parsers.find do |klass| klass.url == url end raise "No parser available for #{url}" unless parser_class parser_class.new end end end end