Sha256: 032b80b227b7b222301c293ea1eb0281d43ffe5218352af666cdb103c3883d5f

Contents?: true

Size: 568 Bytes

Versions: 2

Compression:

Stored size: 568 Bytes

Contents

require 'janis/proxy_website_parser'
Dir['./lib/janis/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

2 entries across 2 versions & 1 rubygems

Version Path
janis-0.1.1 lib/janis/parser_factory.rb
janis-0.1.0 lib/janis/parser_factory.rb