Sha256: 47b75dccef1bb39c198dbd5e21be7cc6aa4b0b25826fc7e6b0bb613460491439

Contents?: true

Size: 1011 Bytes

Versions: 14

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true

require "active_record/open_tracing/sql_sanitizer/base"
require "active_record/open_tracing/sql_sanitizer/mysql"
require "active_record/open_tracing/sql_sanitizer/postgres"
require "active_record/open_tracing/sql_sanitizer/sql_server"
require "active_record/open_tracing/sql_sanitizer/sqlite"
require "active_record/open_tracing/sql_sanitizer/regexes"

module ActiveRecord
  module OpenTracing
    module SqlSanitizer
      KLASSES = {
        mysql: Mysql,
        postgres: Postgres,
        sql_server: SqlServer,
        sqlite: Sqlite
      }.freeze

      class << self
        def build_sanitizer(sanitizer_name)
          sanitizer_klass(sanitizer_name).new
        end

        private

        def sanitizer_klass(sanitizer_name)
          key = KLASSES.keys.detect do |name|
            sanitizer_name.to_sym == name
          end || (raise NameError, "Unknown sanitizer #{sanitizer_name.inspect}")

          KLASSES.fetch(key)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
activerecord-instrumentation-0.6.2 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.1 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.1.pre lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.0 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.0.jhemphill4 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.0.jhemphill3 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.0.jhemphill2 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.6.0.jhemphill1 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.5.2 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.5.2.pre lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.5.1 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.5.1.pre lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.4.0 lib/active_record/open_tracing/sql_sanitizer.rb
activerecord-instrumentation-0.4.0.jlauer4 lib/active_record/open_tracing/sql_sanitizer.rb