Class: Hanami::Providers::DB::Config
- Inherits:
-
Dry::Configurable::Config
- Object
- Dry::Configurable::Config
- Hanami::Providers::DB::Config
- Includes:
- Dry::Core::Constants
- Defined in:
- lib/hanami/providers/db/config.rb
Overview
Instance Method Summary collapse
- #adapter(name) {|adapter| ... } ⇒ Object
- #each_plugin ⇒ Object private
- #gateway(key) {|gateway| ... } ⇒ Object
Instance Method Details
#adapter(name) {|adapter| ... } ⇒ Object
23 24 25 26 27 |
# File 'lib/hanami/providers/db/config.rb', line 23 def adapter(name) adapter = adapters.adapter(name) yield adapter if block_given? adapter end |
#each_plugin ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hanami/providers/db/config.rb', line 30 def each_plugin return to_enum(__method__) unless block_given? gateways.values.group_by(&:adapter_name).each do |adapter_name, adapter_gateways| per_adapter_plugins = adapter_gateways.map { _1.adapter.plugins }.flatten(1).uniq per_adapter_plugins.each do |plugin_spec, config_block| yield adapter_name, plugin_spec, config_block end end end |