strum 0.0.44 → 0.0.45

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: a57301cc87c1615e5effe09364287317e208c3289cf496735be761795c232dd8
4
- data.tar.gz: e2ee2320cd56d4870bb65148104f099b600c36bdd37df206f810e0c913a5d85f
3
+ metadata.gz: f7bb30342859374b985c24a047dc052fe725222770777bcbf1c7105f02b2197f
4
+ data.tar.gz: ffc06d34e9c00e1816b091cd5535af45de5ed3de9266488eddc008480f59ac68
5
5
  SHA512:
6
- metadata.gz: b04b2e31d6f3e4930edcfe8f87df93d79a122d07edb4a736c7a247499e9cba488fe35692f7af3459ee65bbda8efb30d245baed977b691134a3da7e234324ee79
7
- data.tar.gz: 1a4d4cce11ce1ab285fe7d2ff1d70f110610c496056e68c3baebcf66d18164fdb222f8754cb8862da436a7eb17cc8b78f998bdd663c25380b9a582a57837252c
6
+ metadata.gz: 6c9a50e0d2ccf3b63fe3c898f6ffb33e87b9f955b733185e0430c455bf5fd058dbeae0fcb81ad284ddc221cb69188975f474adfa286ca903cd22902a0c558bd4
7
+ data.tar.gz: 024d94ae252ce046cbd899de5205f45d7251dafd320bfc08b3d5e91ba8ed71ba7ac0fd964dcd5c5a56591ebb0e10c617bed1693a1518e9cb23bcda9782a46d4c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strum (0.0.43)
4
+ strum (0.0.45)
5
5
  dry-inflector (~> 0.2.0)
6
6
  thor (~> 0.20)
7
7
 
@@ -11,13 +11,21 @@ module Strum
11
11
  define_method :call do
12
12
  require "serializers/#{Dry::Inflector.new.underscore(name)}_serializer"
13
13
  serializer_class = Strum::SerializerClass.call(name: name)
14
- output(serializer_class.new(input).serializable_hash)
14
+ output(serializer_class.new(model, options).serializable_hash)
15
+ end
16
+
17
+ define_method :model do
18
+ input.is_a?(Sequel::Model) ? input : input[:model]
19
+ end
20
+
21
+ define_method :options do
22
+ input.is_a?(Sequel::Model) ? {} : input.except(:model)
15
23
  end
16
24
  end
17
25
  end
18
26
 
19
- def self.call(model)
20
- model.class.call(model)
27
+ def self.call(model, **options)
28
+ const_get(model.class.name, false).call(options.merge(model: model))
21
29
  end
22
30
  end
23
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strum
4
- VERSION = "0.0.44"
4
+ VERSION = "0.0.45"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.44
4
+ version: 0.0.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serhiy Nazarov