lib/chamber/settings.rb in chamber-2.14.2 vs lib/chamber/settings.rb in chamber-2.14.3
- old
+ new
@@ -8,10 +8,11 @@
require 'chamber/filters/environment_filter'
require 'chamber/filters/secure_filter'
require 'chamber/filters/translate_secure_keys_filter'
require 'chamber/filters/insecure_filter'
require 'chamber/filters/failed_decryption_filter'
+require 'chamber/refinements/enumerable'
###
# Internal: Represents the base settings storage needed for Chamber.
#
module Chamber
@@ -39,10 +40,13 @@
],
secure_key_prefix: '_secure_',
settings: {},
**_args
)
+
+ ::Chamber::Refinements::Enumerable.deep_validate_keys(settings, &:to_s)
+
self.decryption_keys = decryption_keys
self.encryption_keys = encryption_keys
self.namespaces = namespaces
self.post_filters = post_filters
self.pre_filters = pre_filters
@@ -226,12 +230,12 @@
data == other.data &&
namespaces == other.namespaces
end
def [](key)
- warn "WARNING: Bracket access will require strings instead of symbols in Chamber 3.0. You attempted to access the '#{key}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-bracket-indifferent-access for full details." if key.is_a?(::Symbol) # rubocop:disable Layout/LineLength
- warn "WARNING: Accessing a non-existent key ('#{key}') with brackets will fail in Chamber 3.0. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#bracket-access-now-fails-on-non-existent-keys for full details." unless data.has_key?(key) # rubocop:disable Layout/LineLength
+ warn "WARNING: Bracket access will require strings instead of symbols in Chamber 3.0. You attempted to access the '#{key}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-bracket-indifferent-access for full details. Called from: '#{caller.to_a.first}'" if key.is_a?(::Symbol) # rubocop:disable Layout/LineLength
+ warn "WARNING: Accessing a non-existent key ('#{key}') with brackets will fail in Chamber 3.0. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#bracket-access-now-fails-on-non-existent-keys for full details. Called from: '#{caller.to_a.first}'" unless data.has_key?(key) # rubocop:disable Layout/LineLength
data.[](key)
end
def dig!(*args)
@@ -271,11 +275,11 @@
))
end
def method_missing(name, *args)
if data.respond_to?(name)
- warn "WARNING: Object notation access is deprecated and will be removed in Chamber 3.0. You attempted to access the '#{name}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-object-notation-access for full details." # rubocop:disable Layout/LineLength
- warn "WARNING: Predicate methods are deprecated and will be removed in Chamber 3.0. You attempted to access the '#{name}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-predicate-accessors for full details." if name.to_s.end_with?('?') # rubocop:disable Layout/LineLength
+ warn "WARNING: Object notation access is deprecated and will be removed in Chamber 3.0. You attempted to access the '#{name}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-object-notation-access for full details. Called from: '#{caller.to_a.first}'" # rubocop:disable Layout/LineLength
+ warn "WARNING: Predicate methods are deprecated and will be removed in Chamber 3.0. You attempted to access the '#{name}' setting. See https://github.com/thekompanee/chamber/wiki/Upgrading-To-Chamber-3.0#removal-of-predicate-accessors for full details. Called from: '#{caller.to_a.first}'" if name.to_s.end_with?('?') # rubocop:disable Layout/LineLength
data.public_send(name, *args)
else
super
end