Sha256: 288c0d0c0762e92773ab3b0484331870ac84038c9b61e7d647789b256526adb1
Contents?: true
Size: 684 Bytes
Versions: 3
Compression:
Stored size: 684 Bytes
Contents
module ChainReactor require 'parsers/parser' require 'parsers/json_parser' # Used to parse strings using a method defined by child classes. class ParserFactory # Class method for retrieving a new Parser object depending on the type # variable. def self.get_parser(type,logger) class_name = type.to_s.capitalize if class_name.include? "_" class_name = class_namesplit('_').map{|e| e.capitalize}.join end parser_class_name = class_name + 'Parser' logger.debug { "Creating parser: #{parser_class_name}" } parser_class = ChainReactor::Parsers.const_get parser_class_name parser_class.new(logger) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chain-reactor-0.2.2 | lib/chain-reactor/parser_factory.rb |
chain-reactor-0.2.1 | lib/chain-reactor/parser_factory.rb |
chain-reactor-0.2.0 | lib/chain-reactor/parser_factory.rb |