dorian-json-deep-map 1.0.0 → 1.1.0

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/json-deep-map +6 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 321de00122085b3493353f9e1d6acca4c52a06ba0894380b450a8a5784e81fb7
4
- data.tar.gz: fa5ffbd105eaca9dfde0ff5ebd9b756b81b07352b1d84fc2fce4c8c42c3d14f3
3
+ metadata.gz: 01d8400654c8a7ab7fab8be8a7371b4b13be998fd6aea2febcb4e424ab04703b
4
+ data.tar.gz: 83b41fbc2f9a32e9375a9bbb9b29243bac6b6dec3da89801c46c6179dc940d58
5
5
  SHA512:
6
- metadata.gz: 6514093a5eb3f50c87d56d94b798c4ed0c2261f634eb092cd57c742a6576394b5ffdeaf00c1a2423fe87e328899ae7cc358f957f9a748649dff8f26c47d55852
7
- data.tar.gz: 4c75b89fdaa9bf76fb6a211b20dab768429e44b153bbad288e2603d8ada7a98fdab32cdd71e79c61a67227ddc47c33e583bc958d5047033d46299b1d93b832c0
6
+ metadata.gz: 40161acd5cfcf7ff97665d69abd5fca04fca2bd316d97be03ab4ab03d5d4e09e92fbb3e23fbf77ed247dd522dc2461a1cb56a13d6d5798d9086f2ad2b5fd040a
7
+ data.tar.gz: ec2b9640d114d357b37019ca1aa0f007c3c0ab2c64f6ea1ea825e6f4ecf318b16887d324abf5c03ee333532b8841294d8cc24d3d6d061e0f29ba6802c223f3ed
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
- yield(json).to_h { |key, value| deep_map([key, value], &block) }
12
+ json.to_h { |key, value| deep_map([key, value], &block) }
10
13
  elsif json.is_a?(Array)
11
- yield(json).map { |element| deep_map(element, &block) }
14
+ json.map { |element| deep_map(element, &block) }
12
15
  else
13
- yield(json)
16
+ json
14
17
  end
15
18
  end
16
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-json-deep-map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié