rollbar-notification-rules-generator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b69971ea33eb831637b2fbc7170b01dd6cce53e45f02d6f0b2c45c019900ed5a
|
4
|
+
data.tar.gz: 43b362b542727d83795bbc5efd0f9f219a224e0f2030d3579be755e97477f111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61baf0e620d426b92f9bcd5ea00709969d1b183febcbfe0f4cc8b9f288f2f23e33d4aea71d8e4a0357eb441b4a111ebbdfd40b45e54d37df971ff475df061ec
|
7
|
+
data.tar.gz: 0baee819bff11502752157d296a978a5a50e48f2e9efcaac4593a9820e192fe3801c2cafa1566857f12dc2b2df98fcd8e570fd17c8b760548a1c893effd48bc4
|
@@ -50,12 +50,22 @@ module Rollbar
|
|
50
50
|
|
51
51
|
# @return [Rule]
|
52
52
|
def remove_redundant_conditions!
|
53
|
+
@conditions.uniq!
|
53
54
|
@conditions.delete_if do |condition|
|
54
55
|
@conditions.any? { |other| condition.redundant_to?(other) }
|
55
56
|
end
|
56
57
|
self
|
57
58
|
end
|
58
59
|
|
60
|
+
def never_met?
|
61
|
+
@conditions.each.with_index.any? do |condition, i|
|
62
|
+
@conditions[i + 1 ..].any? do |other|
|
63
|
+
next false unless condition.respond_to?(:build_complement_condition)
|
64
|
+
other == condition.build_complement_condition
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
59
69
|
# @param old_condition [Condition::Base]
|
60
70
|
# @param new_condition [Condition::Base]
|
61
71
|
# @return [Rule]
|
@@ -102,9 +102,12 @@ module Rollbar
|
|
102
102
|
new_rules << new_rule
|
103
103
|
else
|
104
104
|
additional_conditions_set.each do |additional_conditions|
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
new_rule_with_additional_conds = new_rule.dup
|
106
|
+
.add_conditions!(additional_conditions)
|
107
|
+
.remove_redundant_conditions!
|
108
|
+
unless new_rule_with_additional_conds.never_met?
|
109
|
+
new_rules << new_rule_with_additional_conds
|
110
|
+
end
|
108
111
|
end
|
109
112
|
end
|
110
113
|
end
|
@@ -114,7 +117,15 @@ module Rollbar
|
|
114
117
|
highest_lowest_target_level = lowest_target_level
|
115
118
|
end
|
116
119
|
level_value_to_additional_conditions_set.merge!(rule.build_additional_conditions_set_for_subsequent_rules) do |_, v1, v2|
|
117
|
-
v1.product(v2).map(&:flatten)
|
120
|
+
additional_conditions_set = v1.product(v2).map(&:flatten)
|
121
|
+
|
122
|
+
additional_conditions_set.reject! do |conditions|
|
123
|
+
conditions.each.with_index.any? do |condition, i|
|
124
|
+
conditions[i + 1 ..].any? { |other| other == condition.build_complement_condition }
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
additional_conditions_set
|
118
129
|
end
|
119
130
|
end
|
120
131
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar-notification-rules-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- abicky
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This tool generates Rollbar notification rules that are mutually exclusive
|
14
14
|
from a simple YAML file.
|