dorian-anonymize-json 0.1.0 → 0.1.2
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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ca9bc6cbdae04b5c3247c6d3350bdd7040184a53ffe1c57607a2353bcbd1e61
|
4
|
+
data.tar.gz: 179f73c8d8ed18c69d5bf880c415eb4c5e82d6303ea65523887832dbd6f13956
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb482c337f23bf1d1bddd8070ab46afe7bd38d45a77e78ba91f53c216aaf2ee9bde63dbe136a6238560782c27b1a209acfd571dffc04f742cc2caa20267150f
|
7
|
+
data.tar.gz: a02155f3628345f72f623016410371331cf764d1e053a544fd1694bbc336bc53345fc800c88e2feec85cb929ec17fe9806aa6a72f533f059126d42f9497c815e
|
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.2
|
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
|
@@ -48,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
51
|
+
version: 3.3.0
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|