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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed8aa5dec7a904d7e5c3e22d29fb40f7a091be79e8f42acbee618088d941458
4
- data.tar.gz: df4df36cd0d81e1eb8d948171ab31848c68781165db737fd79358352cf1dea3e
3
+ metadata.gz: d7b645308ee4c4d8de0f0e2d576d0683a4997183751b02c20c001272041254c8
4
+ data.tar.gz: 3844b51e1f35968b155c7bdd745bd97116efccc1ab3cd9198b737929fd650c6b
5
5
  SHA512:
6
- metadata.gz: '078a2f02c513888807c53e986b44baa8a129843ac45d9baa881bcafb770691fe64d985789c9d10a77904946c1518c7963159e7e5719dd22bc4791ff603e03e61'
7
- data.tar.gz: a3a37c682c29a9e4fac33dece9d7aa5e5c7788b369cff8d5e10fd1a2052449883512c8df7e8e99f84ae72854cc19e2255eb5c25d585256f8953964f410d002fb
6
+ metadata.gz: b8babbfcee06f5e7180ae3505d91e4e4d41459fc9cda95d7659d63ffe4a7a49068631ce7cbf63709fd6f7712c14b242d7118c66e6f644dcbec83636990542a54
7
+ data.tar.gz: a3c7fd245058a74d398612c192e80b6da60c29b13d5571a35aa105ee2cd41429c9b6517e7f6efbdfa8c40e3fb1f6dd017db1d1fe1515aa3157546b196b6df3c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strum (0.0.34)
4
+ strum (0.0.35)
5
5
  dry-inflector (~> 0.2.0)
6
6
  dry-matcher (~> 0.8.2)
7
7
  thor (~> 0.20)
@@ -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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "strum/json_serializer"
5
+ require "strum/json_deserializer"
data/lib/strum/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strum
4
- VERSION = "0.0.34"
4
+ VERSION = "0.0.35"
5
5
  end
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/json_serializer"
7
- require "strum/json_deserializer"
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.34
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-17 00:00:00.000000000 Z
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