Class: Hanami::Providers::DB::Adapter

Inherits:
Object
  • Object
show all
Includes:
Dry::Configurable
Defined in:
lib/hanami/providers/db/adapter.rb

Overview

Since:

  • 2.2.0

Direct Known Subclasses

SQLAdapter

Instance Method Summary collapse

Constructor Details

#initializeAdapter

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.

Returns a new instance of Adapter.

Since:

  • 2.2.0



18
19
20
# File 'lib/hanami/providers/db/adapter.rb', line 18

def initialize(...)
  @skip_defaults = Hash.new(false)
end

Instance Method Details

#clearObject

Since:

  • 2.2.0



68
69
70
71
# File 'lib/hanami/providers/db/adapter.rb', line 68

def clear
  config.plugins = nil
  self
end

#configure_for_database(database_url) ⇒ 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.

Since:

  • 2.2.0



41
42
# File 'lib/hanami/providers/db/adapter.rb', line 41

def configure_for_database(database_url)
end

#configure_from_adapter(other_adapter) ⇒ 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.

Since:

  • 2.2.0



34
35
36
37
38
# File 'lib/hanami/providers/db/adapter.rb', line 34

def configure_from_adapter(other_adapter)
  return if skip_defaults?

  plugins.concat(other_adapter.plugins).uniq! unless skip_defaults?(:plugins)
end

#gateway_cache_keysObject

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.

Since:

  • 2.2.0



57
58
59
# File 'lib/hanami/providers/db/adapter.rb', line 57

def gateway_cache_keys
  gateway_options
end

#gateway_optionsObject

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.

Since:

  • 2.2.0



62
63
64
# File 'lib/hanami/providers/db/adapter.rb', line 62

def gateway_options
  {}
end

#plugin(**plugin_spec, &config_block) ⇒ Object

Since:

  • 2.2.0



46
47
48
# File 'lib/hanami/providers/db/adapter.rb', line 46

def plugin(**plugin_spec, &config_block)
  plugins << [plugin_spec, config_block]
end

#pluginsObject

Since:

  • 2.2.0



52
53
54
# File 'lib/hanami/providers/db/adapter.rb', line 52

def plugins
  config.plugins ||= []
end

#skip_defaults(setting_name = nil) ⇒ Object

Since:

  • 2.2.0



24
25
26
# File 'lib/hanami/providers/db/adapter.rb', line 24

def skip_defaults(setting_name = nil)
  @skip_defaults[setting_name] = true
end