Class: Qonfig::Settings::KeyMatcher Private
- Inherits:
-
Object
- Object
- Qonfig::Settings::KeyMatcher
- Defined in:
- lib/qonfig/settings/key_matcher.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- SCOPE_SPLITTER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.'
- MATCHER_SCOPE_SPLITTER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'\.'
- GENERIC_PART_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'*'
- GENERIC_REGEXP_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'[^\.]+\.'
- INFINITE_PART_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'#'
- INFINITE_REGEXP_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'\.*.*'
Instance Attribute Summary collapse
- #scope_pattern ⇒ String readonly private
Instance Method Summary collapse
- #generic? ⇒ Boolean private
- #initialize(scope_pattern) ⇒ void constructor private
- #match?(setting_key_pattern) ⇒ Boolean private
Constructor Details
#initialize(scope_pattern) ⇒ void
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.
55 56 57 58 59 60 61 62 |
# File 'lib/qonfig/settings/key_matcher.rb', line 55 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.dup.freeze @scope_pattern_size = count_scope_pattern_size(scope_pattern) @pattern_matcher = build_pattern_matcher(scope_pattern) end |
Instance Attribute Details
#scope_pattern ⇒ String (readonly)
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.
46 47 48 |
# File 'lib/qonfig/settings/key_matcher.rb', line 46 def scope_pattern @scope_pattern end |
Instance Method Details
#generic? ⇒ Boolean
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.
68 69 70 |
# File 'lib/qonfig/settings/key_matcher.rb', line 68 def generic? scope_pattern == GENERIC_PART_PATTERN || scope_pattern == INFINITE_PART_PATTERN end |
#match?(setting_key_pattern) ⇒ Boolean
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.
77 78 79 80 |
# File 'lib/qonfig/settings/key_matcher.rb', line 77 def match?(setting_key_pattern) return false unless comparable_event_scopes?(setting_key_pattern) !!pattern_matcher.match(setting_key_pattern) end |