Class: Janis::Parsing::ParserFactory
- Inherits:
-
Object
- Object
- Janis::Parsing::ParserFactory
- Defined in:
- lib/janis/parser_factory.rb
Instance Attribute Summary collapse
-
#parser_klasses ⇒ Object
readonly
Returns the value of attribute parser_klasses.
Instance Method Summary collapse
- #create_parser(website_name) ⇒ Object
-
#initialize ⇒ ParserFactory
constructor
A new instance of ParserFactory.
Constructor Details
#initialize ⇒ ParserFactory
Returns a new instance of ParserFactory.
12 13 14 |
# File 'lib/janis/parser_factory.rb', line 12 def initialize @parser_klasses = Janis::Parsing::SpecificParsers::ProxyWebsiteParser.subclasses end |
Instance Attribute Details
#parser_klasses ⇒ Object (readonly)
Returns the value of attribute parser_klasses.
10 11 12 |
# File 'lib/janis/parser_factory.rb', line 10 def parser_klasses @parser_klasses end |
Instance Method Details
#create_parser(website_name) ⇒ Object
16 17 18 19 |
# File 'lib/janis/parser_factory.rb', line 16 def create_parser(website_name) namespacing_prefix = "Janis::Parsing::SpecificParsers::" @parser_klasses.find { |parser_klass| parser_klass.to_s == namespacing_prefix + parser_klass_name_for(website_name) }.new end |