Sha256: 1130ab1805b682beed4de2f53f689d9e2649901230e4e1d222617b6e5677f24a
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
# frozen_string_literal: true module SQLRunner UnsupportedDatabase = Class.new(StandardError) MissingDependency = Class.new(StandardError) def self.adapter_registry @adapter_registry ||= {} end module Adapters require "sql_runner/adapters/postgresql" require "sql_runner/adapters/mysql" require "sql_runner/adapters/active_record" def self.register(name, adapter) SQLRunner.adapter_registry[name] = adapter end def self.find(name) adapter = SQLRunner.adapter_registry.fetch(name) do raise UnsupportedDatabase, "#{name} is not supported by SQLRunner" end adapter.tap(&:load) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sql_runner-0.3.0 | lib/sql_runner/adapters.rb |