class Warnings::ParserFactory
Factory class for supported parsers.
Constants
- AVAILABLE_PARSERS
- ERROR_NOT_SUPPORTED
Public Class Methods
create(type)
click to toggle source
Create a new parser implementation.
@param type [Symbol] A key symbol / name to identify the parser. @raise If no implementation could be found for the key. @return [Parser] Implementation
# File lib/warnings/parser/parser_factory.rb, line 20 def self.create(type) key = type key = key.to_sym if key.respond_to?(:to_sym) parser = AVAILABLE_PARSERS[key] raise(format(ERROR_NOT_SUPPORTED, key)) if parser.nil? parser.new end