Module: Mongoid::Config::Encryption Private
- Extended by:
- Encryption
- Included in:
- Mongoid::Config, Encryption
- Defined in:
- lib/mongoid/config/encryption.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module contains the logic for configuring Client Side Field Level automatic encryption.
Instance Method Summary collapse
-
#encryption_schema_map(default_database, models = ::Mongoid.models) ⇒ Hash
private
Generate the encryption schema map for the provided models.
Instance Method Details
#encryption_schema_map(default_database, models = ::Mongoid.models) ⇒ Hash
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.
Generate the encryption schema map for the provided models.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mongoid/config/encryption.rb', line 23 def encryption_schema_map(default_database, models = ::Mongoid.models) visited = Set.new models.each_with_object({}) do |model, map| next if visited.include?(model) visited << model next if model. next unless model.encrypted? database = model..fetch(:database) { default_database } key = "#{database}.#{model.collection_name}" props = (model).merge(properties_for(model, visited)) map[key] = props unless props.empty? end end |