strum-json 0.0.4 → 0.0.5

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: f5cc61c7ea0750663941d233b2e8812add8a4440c2e7e412f01cded2e8701bca
4
- data.tar.gz: a9eb4b24ac3277de873fd4e9d3196884bf9a2c1acb493eb7b0187b6348d25f87
3
+ metadata.gz: 37e07cd2c107cd505d79a6f059d275d96b60e919eb3266634160f0d7d4301e91
4
+ data.tar.gz: 624c379c20a52ba20cd833d848b661b6bbc92f7bc0c6bff7dee56eec6ceaa165
5
5
  SHA512:
6
- metadata.gz: 35b866d62371846e912d7ecae9669d7dbb835a35711aa7d1539888700372a54df0d73d8b2a1afa8dea01143d6340c531654e312d165feecd71ad016d2773d8f7
7
- data.tar.gz: c2160f69038244377bddb2e3c3bf1035813041a93d6702a91cf977c1373bc8b6af3a5a784811bb55d162a28d6da2447e22866c404d521bb678da2e7471e3ee62
6
+ metadata.gz: a95accb4cebabe4e1015acbb2393a9a5cf6170330c73ace6a9f6da700afa99f5f8e076386c8f32000bfcbf380e2d67959bd4605f6394a006a71ba27101f850f1
7
+ data.tar.gz: 4950117e0b759a0c7b1256a24bd9e5ad8e06d4b66d2794468324fb219edeff6ecea1893289370aaf26cb5e206d1308df8535f8f341793e075fa817d6624d0ee3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strum-json (0.0.4)
4
+ strum-json (0.0.5)
5
5
  dry-inflector (~> 0.2.0)
6
6
  json (~> 2.3)
7
7
  json-schema (~> 2.8.1)
@@ -56,7 +56,7 @@ GEM
56
56
  rubocop (~> 1.0)
57
57
  rubocop-ast (>= 1.1.0)
58
58
  ruby-progressbar (1.11.0)
59
- strum-service (0.2.0)
59
+ strum-service (0.2.1)
60
60
  unicode-display_width (2.0.0)
61
61
 
62
62
  PLATFORMS
@@ -71,4 +71,4 @@ DEPENDENCIES
71
71
  strum-json!
72
72
 
73
73
  BUNDLED WITH
74
- 2.2.25
74
+ 2.2.27
@@ -16,16 +16,17 @@ module Strum
16
16
  end
17
17
 
18
18
  define_method :model do
19
- return input if input.is_a?(Sequel::Model)
20
- return input if input.is_a?(Dry::Struct)
21
- return input if input.is_a?(Array) && (input.first.is_a?(Sequel::Model) || input.first.is_a?(Dry::Struct))
19
+ return input if defined?(Sequel::Model) && input.is_a?(Sequel::Model)
20
+ return input if defined?(Dry::Struct) && input.is_a?(Dry::Struct)
21
+ return input if input.is_a?(Array) && ((defined?(Sequel::Model) && input.first.is_a?(Sequel::Model)) ||
22
+ (defined?(Dry::Struct) && input.first.is_a?(Dry::Struct)))
22
23
 
23
24
  input[:model]
24
25
  end
25
26
 
26
27
  define_method :options do
27
- return {} if input.is_a?(Sequel::Model)
28
- return {} if input.is_a?(Dry::Struct)
28
+ return {} if defined?(Sequel::Model) && input.is_a?(Sequel::Model)
29
+ return {} if defined?(Dry::Struct) && input.is_a?(Dry::Struct)
29
30
  return {} if input.is_a?(Array)
30
31
 
31
32
  input.except(:model)
@@ -34,7 +35,8 @@ module Strum
34
35
  end
35
36
 
36
37
  def self.call(model, **options)
37
- const_get(model.class.name.split("::").last, false).call(options.merge(model: model))
38
+ klass = model.is_a?(Array) ? model.first.class : model.class
39
+ const_get(klass.name.split("::").last, false).call(options.merge(model: model))
38
40
  end
39
41
  end
40
42
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Strum
4
4
  module Json
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strum-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhiy Nazarov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-05 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-inflector