Sha256: 87d14ddf472c1302536c0def57e757987b7041935e17110574f985dd1a05b9ad
Contents?: true
Size: 694 Bytes
Versions: 45
Compression:
Stored size: 694 Bytes
Contents
require 'thread' require 'treetop' require 'flydata-core/table_def' module Flydata module Parser class ParserProvider @@mutex = Mutex.new @@parsers = {} def self.parser(db_type, parser_type) key = [db_type.to_s, parser_type.to_s].join("::").to_s @@mutex.synchronize do if @@parsers[key] return @@parsers[key] else # lazy load treetop_path = File.expand_path( "../source_#{db_type}/parser/#{parser_type}.treetop", File.dirname(__FILE__)) Treetop.load treetop_path @@parsers[key] = "#{parser_type}_parser".camelize.constantize end end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems