lib/qonfig/settings/key_matcher.rb in qonfig-0.17.0 vs lib/qonfig/settings/key_matcher.rb in qonfig-0.18.0
- old
+ new
@@ -37,21 +37,28 @@
#
# @api private
# @since 0.13.0
INFINITE_REGEXP_PATTERN = '\.*.*'
- # @param scope_pattern [String]
+ # @return [String]
+ #
+ # @api private
+ # @since 0.13.0
+ attr_reader :scope_pattern
+
+ # @param scope_pattern [String, Symbol]
# @return [void]
#
# @raise [Qonfig::ArgumentError]
#
# @api private
# @since 0.13.0
def initialize(scope_pattern)
+ scope_pattern = scope_pattern.to_s if scope_pattern.is_a?(Symbol)
raise Qonfig::ArgumentError unless scope_pattern.is_a?(String)
- @scope_pattern = scope_pattern
+ @scope_pattern = scope_pattern.dup.freeze
@scope_pattern_size = count_scope_pattern_size(scope_pattern)
@pattern_matcher = build_pattern_matcher(scope_pattern)
end
# @param setting_key_pattern [String]
@@ -69,15 +76,9 @@
# @return [Regexp]
#
# @api private
# @since 0.13.0
attr_reader :pattern_matcher
-
- # @return [String]
- #
- # @api private
- # @since 0.13.0
- attr_reader :scope_pattern
# @return [Integer, Float::INFINITY]
#
# @api private
# @since 0.13.0