Class: Logster::GroupingPattern
- Defined in:
- lib/logster/grouping_pattern.rb
Constant Summary collapse
- CACHE_KEY =
:grouping
Class Method Summary collapse
Instance Method Summary collapse
-
#destroy(clear_cache: true) ⇒ Object
arg used in tests.
- #save(args = {}) ⇒ Object
Methods inherited from Pattern
child_classes, find, find_all, inherited, #initialize, #modify, parse_pattern, #pattern, #to_s, valid?, #valid?
Constructor Details
This class inherits a constructor from Logster::Pattern
Class Method Details
.set_name ⇒ Object
6 7 8 |
# File 'lib/logster/grouping_pattern.rb', line 6 def self.set_name "__LOGSTER__grouping_patterns_set".freeze end |
Instance Method Details
#destroy(clear_cache: true) ⇒ Object
arg used in tests
24 25 26 27 28 |
# File 'lib/logster/grouping_pattern.rb', line 24 def destroy(clear_cache: true) # arg used in tests super() @store.remove_pattern_group(self.pattern) @store.clear_patterns_cache(CACHE_KEY) if clear_cache end |
#save(args = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/logster/grouping_pattern.rb', line 10 def save(args = {}) super existing_groups = @store.find_pattern_groups group = Logster::Group.new(self.to_s) = @store.(with_env: false) .select! do |m| m. =~ self.pattern && existing_groups.none? { |g| g..include?(m.key) } end group. = group.count = .size @store.save_pattern_group(group) if group.changed? @store.clear_patterns_cache(CACHE_KEY) end |