baze 1.0 → 1.1.1

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/jsonflat +44 -0
  3. metadata +17 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 793de13673e5af31ba8dbd309d34f91ed115aa04
4
- data.tar.gz: b6ccea386abc9e4d9dd102ecf96ebeb8b88e6747
3
+ metadata.gz: 8cbf73fde50470dd9adc667314de6a641c5422ae
4
+ data.tar.gz: 8454583eeff8270774bca055e770d90bb2b1753b
5
5
  SHA512:
6
- metadata.gz: be710fefcc1ad5739925b0015e1f2f1e52f1030beafa8f49bede9a7617612c37fddf9c6329657382cebc3100f869fb2ebc12bd4231e7ac1178dceb86a9670e65
7
- data.tar.gz: 9ecfdca62b3a8302e910cbb9dc6ca8e18c10134d6f7b0d214867b1e9d9b61c7c693f0f9a9435b7d6104cb1f85a400b4a8fc36330c6b6382e66ce9cfd1b039157
6
+ metadata.gz: 37b3c338bb05f806c5e45004e6392388b2845d432f1e301b3226dc7b466e023bfcc141a7bb77ae41bbd28c405eab3198793446b110e181d1294e76fa26a7b70c
7
+ data.tar.gz: 6cc6b194fa4cbe588968dd07e48d62173b635c01e9b4e58fca802523fb99a25dbe9dc4f5f202dc1ebfb8caa391cb3924865024ef8c51f11e7dd7e9cb2328443b
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ require 'json'
3
+
4
+ def escaped name
5
+ if name =~ /\.=/
6
+ name.inspect
7
+ else
8
+ name
9
+ end
10
+ end
11
+
12
+ def subpath parent, name
13
+ if parent
14
+ "#{parent}.#{escaped name}"
15
+ else
16
+ escaped name
17
+ end
18
+ end
19
+
20
+ def format node
21
+ case node
22
+ when nil
23
+ 'null'
24
+ else
25
+ node.inspect
26
+ end
27
+ end
28
+
29
+ def traverse node, path
30
+ case node
31
+ when Hash
32
+ node.each_pair do |k, v|
33
+ traverse v, subpath(path, k)
34
+ end
35
+ when Enumerable
36
+ node.each_with_index do |v, i|
37
+ traverse v, subpath(path, i)
38
+ end
39
+ else
40
+ puts "#{path}=#{format node}"
41
+ end
42
+ end
43
+
44
+ traverse JSON::parse(ARGF.read), nil
metadata CHANGED
@@ -1,36 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baze
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Carrier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-25 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
15
- - pierre@gcarrier.fr
15
+ - pc@rrier.ca
16
16
  executables:
17
- - urlencode
18
- - shellescape
19
- - suc
20
17
  - primes
21
18
  - cols
19
+ - json2yaml
20
+ - urldecode
21
+ - yaml2json
22
+ - lecho
23
+ - jsonflat
24
+ - randmac
22
25
  - hex2ip
23
- - fixperms
24
26
  - shost
25
- - cupa
26
- - lecho
27
+ - suc
27
28
  - rrtmux
28
- - randmac
29
+ - urlencode
29
30
  - ip2hex
30
- - urldecode
31
- - yaml2json
31
+ - shellescape
32
32
  - statistik
33
- - json2yaml
33
+ - cupa
34
+ - fixperms
34
35
  extensions: []
35
36
  extra_rdoc_files: []
36
37
  files:
@@ -41,6 +42,7 @@ files:
41
42
  - bin/hex2ip
42
43
  - bin/ip2hex
43
44
  - bin/json2yaml
45
+ - bin/jsonflat
44
46
  - bin/lecho
45
47
  - bin/primes
46
48
  - bin/randmac
@@ -71,8 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
73
  - !ruby/object:Gem::Version
72
74
  version: 1.2.0
73
75
  requirements: []
74
- rubyforge_project: baze
75
- rubygems_version: 2.6.13
76
+ rubyforge_project:
77
+ rubygems_version: 2.5.2.3
76
78
  signing_key:
77
79
  specification_version: 4
78
80
  summary: Base utilities for POSIX system