lib/qonfig/settings.rb in qonfig-0.16.0 vs lib/qonfig/settings.rb in qonfig-0.17.0
- old
+ new
@@ -270,16 +270,37 @@
# @since 0.13.0
def __is_a_setting__(value)
value.is_a?(Qonfig::Settings)
end
+ # @param key_path [Array<Symbol, String>]
+ # @return [Boolean]
+ #
+ # @api private
+ # @since 0.17.0
+ def __has_key__(*key_path)
+ __lock__.thread_safe_access { __is_key_exists__(*key_path) }
+ end
+
private
# @return [Qonfig::Settings::Lock]
#
# @api private
# @since 0.2.0
attr_reader :__lock__
+
+ # @param key_path [Array<String, Symbol>]
+ # @return [Boolean]
+ #
+ # @api private
+ # @since 0.17.0
+ def __is_key_exists__(*key_path)
+ __deep_access__(*key_path)
+ true
+ rescue Qonfig::UnknownSettingError
+ false
+ end
# @param block [Proc]
# @return [Enumerable]
#
# @yield [setting_key, setting_value]