mini_defender 0.5.1 → 0.5.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: f7eb4878351ebf49bb42e33a10f8fefd34745b4067bdf40b50180792d2883819
|
4
|
+
data.tar.gz: 93ec54964db744a7f2f03a7fc23bf96b6458637d94dbfb00c4307a0e5e598964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04dc7d2a819a0d3f8e443342900bd29db0c7e9b730128ff7d8f266f7853e52079166903997f660ef87c26c3965dd689c229bd5e533a0ff824debd3548f65417
|
7
|
+
data.tar.gz: cd0109845a3f6f2ddc22c23448856124384554b6e3bbc75f1d952773c589797a421c1f7e04da15ed3461713f65ee436a8c102776ff0377dbbdeecc96da746196
|
data/lib/mini_defender/rule.rb
CHANGED
@@ -16,6 +16,13 @@ class MiniDefender::Rule
|
|
16
16
|
true
|
17
17
|
end
|
18
18
|
|
19
|
+
# Priority is used to sort rules in a rule set to allow rules to validate data
|
20
|
+
# before rules that will radically change data
|
21
|
+
# @return [Integer]
|
22
|
+
def priority
|
23
|
+
100
|
24
|
+
end
|
25
|
+
|
19
26
|
# @param [MiniDefender::Validator] validator
|
20
27
|
# @return [Boolean]
|
21
28
|
def implicit?(validator)
|
@@ -11,16 +11,23 @@ module MiniDefender
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def init_set(rule_set)
|
14
|
-
|
15
|
-
|
14
|
+
if rule_set.is_a?(String)
|
15
|
+
rule_set = rule_set.split('|')
|
16
|
+
end
|
17
|
+
|
18
|
+
unless rule_set.is_a?(Array)
|
19
|
+
raise ArgumentError, 'Rule set must be a string or an array'
|
20
|
+
end
|
16
21
|
|
17
|
-
rule_set.map do |rule|
|
22
|
+
rule_set = rule_set.map do |rule|
|
18
23
|
unless rule.is_a?(String) || rule.is_a?(Rule)
|
19
24
|
raise ArgumentError, 'Rule must be a string or an instance of MiniDefender::Rule'
|
20
25
|
end
|
21
26
|
|
22
27
|
rule.is_a?(String) ? init_rule(rule) : rule
|
23
28
|
end
|
29
|
+
|
30
|
+
rule_set.sort_by! { |r| r.priority }
|
24
31
|
end
|
25
32
|
|
26
33
|
def init_rule(signature)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_defender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Alhoshaiyan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|