dorian-anonymize-yaml 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/anonymize-yaml +8 -13
- 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: 0d8e810270458b2e549c0445708077302556fe894cea8f0449088f025789e147
|
4
|
+
data.tar.gz: b8302f656297f15f006d76e8ab0c38b88ab526518bf098fa1079b9923ec24c3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe6763f90d18d07df527905f0ed4697469daa2bee8866fe5c4001939da5a644dbff2eb8ecbc3048186627544b98cab2efd901b383a970f1eddb7c55f3589f79
|
7
|
+
data.tar.gz: 42f84c5f1a44deddb06af23e894073f63222a427c1fac87900bce2d35d6773a9ddfd320d912690246ca48e3e9921d6ff122eb7f0899964b082d3bd18c66416f5
|
data/bin/anonymize-yaml
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
|
-
#!/usr/bin/env ruby
|
4
|
-
# frozen_string_literal: true
|
5
3
|
|
6
4
|
require "yaml"
|
7
5
|
|
8
6
|
def anonymize_yaml(data)
|
9
|
-
|
7
|
+
case data
|
8
|
+
when Array
|
10
9
|
data.map { |element| anonymize_yaml(element) }
|
11
|
-
|
10
|
+
when Hash
|
12
11
|
data.transform_values { |value| anonymize_yaml(value) }
|
13
|
-
|
12
|
+
when String
|
14
13
|
data.gsub(/[0-9]/, "0").gsub(/[a-z]/, "a").gsub(/[A-Z]/, "A")
|
15
|
-
|
14
|
+
when Integer
|
16
15
|
0
|
17
|
-
|
16
|
+
when Float
|
18
17
|
0.0
|
19
|
-
|
18
|
+
when TrueClass, FalseClass
|
20
19
|
false
|
21
20
|
else
|
22
21
|
raise NotImplementedError, data.class.name
|
@@ -35,11 +34,7 @@ if inputs.empty?
|
|
35
34
|
inputs = $stdin.each_line.to_a
|
36
35
|
|
37
36
|
inputs =
|
38
|
-
|
39
|
-
inputs.map(&:strip)
|
40
|
-
else
|
41
|
-
[inputs.join]
|
42
|
-
end
|
37
|
+
(File.exist?(inputs.first.strip) ? inputs.map(&:strip) : [inputs.join])
|
43
38
|
end
|
44
39
|
|
45
40
|
inputs.each do |input|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-anonymize-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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
|
description: |-
|
14
14
|
Anonymize YAML file
|