dorian-anonymize-json 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/anonymize-json +8 -11
- 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: 5b10d9d8a9ef04993832be6ab68a62c9bba02e9a15b6535fae0a02f9c8b55081
|
4
|
+
data.tar.gz: e0840d07bdc4d87740838f7905a3144e57e39ad7396579d9b72c6bd42e55402a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85f30cf6569e7bf7c557f7336cdaa878dab40613b4abf22bb3d314ca398882fa4c662e7f92be1bec36fe3849d285533e859713ba29475c16801212b40810128b
|
7
|
+
data.tar.gz: d7ac659d52ebc290348c8137c24f938fa87c029dba56bb746c23b72366932ae16f7599e5f53826f9e5efff9dc3387fb8328f42a3b3344bbfd56daf192e57b01f
|
data/bin/anonymize-json
CHANGED
@@ -4,17 +4,18 @@
|
|
4
4
|
require "json"
|
5
5
|
|
6
6
|
def anonymize_json(data)
|
7
|
-
|
7
|
+
case data
|
8
|
+
when Array
|
8
9
|
data.map { |element| anonymize_json(element) }
|
9
|
-
|
10
|
+
when Hash
|
10
11
|
data.transform_values { |value| anonymize_json(value) }
|
11
|
-
|
12
|
+
when String
|
12
13
|
data.gsub(/[0-9]/, "0").gsub(/[a-z]/, "a").gsub(/[A-Z]/, "A")
|
13
|
-
|
14
|
+
when Integer
|
14
15
|
0
|
15
|
-
|
16
|
+
when Float
|
16
17
|
0.0
|
17
|
-
|
18
|
+
when TrueClass, FalseClass
|
18
19
|
false
|
19
20
|
else
|
20
21
|
raise NotImplementedError, data.class.name
|
@@ -33,11 +34,7 @@ if inputs.empty?
|
|
33
34
|
inputs = $stdin.each_line.to_a
|
34
35
|
|
35
36
|
inputs =
|
36
|
-
|
37
|
-
inputs.map(&:strip)
|
38
|
-
else
|
39
|
-
[inputs.join]
|
40
|
-
end
|
37
|
+
(File.exist?(inputs.first.strip) ? inputs.map(&:strip) : [inputs.join])
|
41
38
|
end
|
42
39
|
|
43
40
|
inputs.each do |input|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-anonymize-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03
|
11
|
+
date: 2024-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|