Class: CouchbaseOrm::IndexConfigLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase-orm/index_config_loader.rb

Constant Summary collapse

SUPPORTED_KEYS =
%i[bucket migrations_path schema_path num_replica].freeze

Class Method Summary collapse

Class Method Details

.apply(config_hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/couchbase-orm/index_config_loader.rb', line 9

def self.apply(config_hash)
  config_hash = config_hash.with_indifferent_access
  index_hash = (config_hash[:index] || {}).with_indifferent_access

  index_config = {
    bucket: config_hash[:bucket]
  }.merge(index_hash.slice(*SUPPORTED_KEYS))

  index_config.each do |key, value|
    CouchbaseOrm.config.index.public_send("#{key}=", value)
  end
end