mini_defender 0.3.0 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mini_defender/validates_input.rb +14 -7
- data/lib/mini_defender/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7424b4c9c74d8e9261dc3cfa15539c193d64c09cb332292f806388ecae88a264
|
4
|
+
data.tar.gz: 1a7906b5333de07269ca70e49eebd3bd0e9d80f554fff526fa5c4a85325fc01b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a53808affa01b7f16c64372038e6e972e7eb7e20ad897253f9c14fe96004050d1aa3964f4dda298a4b8e8d3d2c03aeba3fa3e8248a3147a82ddb6d5ba0d3588e
|
7
|
+
data.tar.gz: 8ca880670adbe33e1af0cc5191bcaed92d6dc4bb9c7314107581acf4f5e39f86a968e27d6f50bb62d1bfce786bf7a49706b4d52e298b3834a238784ad4e9c7e1
|
@@ -12,13 +12,20 @@ module MiniDefender::ValidatesInput
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
def cleanse_data(data)
|
16
|
-
data
|
17
|
-
v = v.strip
|
18
|
-
v = nil if v.blank?
|
19
|
-
[k, v]
|
20
|
-
end
|
15
|
+
def cleanse_data(data, depth = 1)
|
16
|
+
return data if depth > 16
|
21
17
|
|
22
|
-
data
|
18
|
+
case data
|
19
|
+
when Array
|
20
|
+
data.map{ |v| cleanse_data(v, depth + 1) }.reject(&:nil?)
|
21
|
+
when Hash
|
22
|
+
data.to_h{ |k, v| [k, cleanse_data(v, depth + 1)] }.compact
|
23
|
+
when String
|
24
|
+
data = data.strip
|
25
|
+
data = nil if data == ''
|
26
|
+
data
|
27
|
+
else
|
28
|
+
data
|
29
|
+
end
|
23
30
|
end
|
24
31
|
end
|
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.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Alhoshaiyan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|