Sha256: 1692d567cc88d655c2c66d3166b750e6864528bb7e907a58cbf3cf64d0ab7b1d

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
janis-0.1.2 lib/janis/parser_factory.rb