dorian-anonymize-yaml 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/anonymize-yaml +8 -13
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 448c95f5d663f8cd1ed6b0e63a4eee34fbae647023ab391b6bdfa1b0acb9fc1c
4
- data.tar.gz: 0b7becac5519496c641f71f82dd6c066c80403b69d4892bc0468dc4c7a79b404
3
+ metadata.gz: 9d56df1ec8a853a485343855dadf951e8b7c84d45497095bc0f5a5d813bc19e0
4
+ data.tar.gz: 7b76ff092de4898d4dad076c891d6d8a7d08dfc808d1253ad26d35bd5b86d82e
5
5
  SHA512:
6
- metadata.gz: 6677e442abc21d0a1589e3a941a005b20c5f9d97be524b3f5db230a24d248e8e6ef9ba1da6a080692cd61299e9a4ae5edc960290896ebe423ce05f421295a500
7
- data.tar.gz: 3d5f9f7dcb9a49d9124002888dcca3348591438045edd86fe49b0dd7055f27876d05d2180ec3c6d8e8d443643a0fdb7ed6f9fd87a7ede10813aba1d703de4baf
6
+ metadata.gz: 349a5dc57d744834580d8555c2aa0c59be1f015a69c577f6342dedb270b9480c1f711e22543e3b99922d6440e88d681f07c52d24f16f05317f7e22eb74b35e63
7
+ data.tar.gz: b5c692b6eafcb116416ea57d6ec3ac03ea098cb20889929165e1fc071d1e92b1e62a9f2e47d093fab4c28bcbd6ecd7548ef8d7d5ec0fde216197bc3561efab98
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
- if data.is_a?(Array)
7
+ case data
8
+ when Array
10
9
  data.map { |element| anonymize_yaml(element) }
11
- elsif data.is_a?(Hash)
10
+ when Hash
12
11
  data.transform_values { |value| anonymize_yaml(value) }
13
- elsif data.is_a?(String)
12
+ when String
14
13
  data.gsub(/[0-9]/, "0").gsub(/[a-z]/, "a").gsub(/[A-Z]/, "A")
15
- elsif data.is_a?(Integer)
14
+ when Integer
16
15
  0
17
- elsif data.is_a?(Float)
16
+ when Float
18
17
  0.0
19
- elsif data.is_a?(TrueClass) || data.is_a?(FalseClass)
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
- if File.exist?(inputs.first.strip)
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.2
4
+ version: 0.1.4
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-09 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Anonymize YAML file
@@ -34,7 +34,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
35
  - - ">="
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 3.3.0
38
38
  required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="