dorian-json-deep-map 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/json-deep-map +7 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0cbdc527c31a863d15cf9962250f6839dabbd4025397744d426f758936a241b
|
4
|
+
data.tar.gz: 817ace3bc69423d5c9a41a134cbaed2244e1aed2804dcdf2b2897c71dd0f6469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43ba9ea9879677df093d21ee5484e0839724ea664cf9a8235b174e5e7c1d5c92d2d6ac32f8737f870d7c09f88f52f39e2317961893d6284c31c9938e272605da
|
7
|
+
data.tar.gz: 792fcf6bad318096383405d59fea0f31a032dcbbe741620f07e9c2aa43578121b185813ca175fea7d9f64f880d33fc9166b1ec8e6da4e17b7596d0a0bb570158
|
data/bin/json-deep-map
CHANGED
@@ -2,15 +2,18 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "dorian/arguments"
|
5
|
+
require "dorian/to_struct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
def deep_map(json, &block)
|
9
|
+
json = yield(json.to_deep_struct).from_deep_struct
|
10
|
+
|
8
11
|
if json.is_a?(Hash)
|
9
|
-
|
12
|
+
json.to_h { |key, value| deep_map([key, value], &block) }
|
10
13
|
elsif json.is_a?(Array)
|
11
|
-
|
14
|
+
json.map { |element| deep_map(element, &block) }
|
12
15
|
else
|
13
|
-
|
16
|
+
json
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
@@ -19,7 +22,7 @@ parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
|
|
19
22
|
abort parsed.help if parsed.options.help
|
20
23
|
|
21
24
|
if parsed.options.version
|
22
|
-
abort File.read(File.expand_path("
|
25
|
+
abort File.read(File.expand_path("../VERSION", __dir__))
|
23
26
|
end
|
24
27
|
|
25
28
|
inputs = parsed.files.map { |file| File.read(file) }
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-json-deep-map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
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-08-
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dorian-arguments
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -71,9 +71,9 @@ require_paths:
|
|
71
71
|
- lib
|
72
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 3.3.4
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|