strum 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/strum/deep_keys_to_sym.rb +32 -0
- data/lib/strum/json.rb +5 -0
- data/lib/strum/version.rb +1 -1
- data/lib/strum.rb +3 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b645308ee4c4d8de0f0e2d576d0683a4997183751b02c20c001272041254c8
|
4
|
+
data.tar.gz: 3844b51e1f35968b155c7bdd745bd97116efccc1ab3cd9198b737929fd650c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8babbfcee06f5e7180ae3505d91e4e4d41459fc9cda95d7659d63ffe4a7a49068631ce7cbf63709fd6f7712c14b242d7118c66e6f644dcbec83636990542a54
|
7
|
+
data.tar.gz: a3c7fd245058a74d398612c192e80b6da60c29b13d5571a35aa105ee2cd41429c9b6517e7f6efbdfa8c40e3fb1f6dd017db1d1fe1515aa3157546b196b6df3c3
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "strum"
|
4
|
+
require "dry-inflector"
|
5
|
+
|
6
|
+
module Strum
|
7
|
+
class DeepKeysToSym
|
8
|
+
include Strum::Service
|
9
|
+
|
10
|
+
def call
|
11
|
+
output(deep_transform_keys(input))
|
12
|
+
end
|
13
|
+
|
14
|
+
def audit
|
15
|
+
required
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def deep_transform_keys(hash)
|
21
|
+
return hash unless hash.is_a?(Hash)
|
22
|
+
|
23
|
+
hash.each_with_object({}) do |(key, value), result|
|
24
|
+
result[inflector.underscore(key).to_sym] = deep_transform_keys(value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def inflector
|
29
|
+
@inflector ||= Dry::Inflector.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/strum/json.rb
ADDED
data/lib/strum/version.rb
CHANGED
data/lib/strum.rb
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
require "strum/version"
|
4
4
|
require "strum/service"
|
5
5
|
require "strum/chain"
|
6
|
-
require "strum/
|
7
|
-
require "strum/
|
6
|
+
require "strum/pipe"
|
7
|
+
require "strum/json"
|
8
|
+
require "strum/deep_keys_to_sym"
|
8
9
|
|
9
10
|
module Strum
|
10
11
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhiy Nazarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -156,6 +156,8 @@ files:
|
|
156
156
|
- lib/strum/commands/resource/scaffold.rb
|
157
157
|
- lib/strum/commands/resource/serializer.rb
|
158
158
|
- lib/strum/commands/resource/service.rb
|
159
|
+
- lib/strum/deep_keys_to_sym.rb
|
160
|
+
- lib/strum/json.rb
|
159
161
|
- lib/strum/json_deserializer.rb
|
160
162
|
- lib/strum/json_serializer.rb
|
161
163
|
- lib/strum/pipe.rb
|