Sha256: 0eceec609cf505ea7c180e759e7ced20b1f77d8909b84a6fdfeea8c35ff2a922
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Hanami module Providers class DB < Hanami::Provider::Source # @api public # @since 2.2.0 class Adapters # @api private # @since 2.2.0 ADAPTER_CLASSES = Hash.new(Adapter).update( sql: SQLAdapter ).freeze private_constant :ADAPTER_CLASSES extend Forwardable def_delegators :adapters, :[], :[]=, :each, :to_h # @api private # @since 2.2.0 def self.new_adapter(name) ADAPTER_CLASSES[name].new end # @api private # @since 2.2.0 attr_reader :adapters # @api private # @since 2.2.0 def initialize @adapters = Hash.new do |hsh, key| hsh[key] = self.class.new_adapter(key) end end # @api private # @since 2.2.0 def initialize_copy(source) @adapters = source.adapters.dup source.adapters.each do |key, val| @adapters[key] = val.dup end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.2.0.beta2 | lib/hanami/providers/db/adapters.rb |