strum-service 0.1.0 → 0.1.1

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: 170761cebb33448b6582a6b19fc488bcb4f77cbf1b437f48b59c36364bb52392
4
- data.tar.gz: 0bf2e44f8b63758ab08c6d56cbfcfcecd51164fd74b8daddc5b33fb2e77e380a
3
+ metadata.gz: f205a707f1b5fe69e7c7939c806739a54550639cb60b99be68991387574999a6
4
+ data.tar.gz: 1027394e5b3f37086596e7835d8658f62e42a48439fdf4747b2426064f8eaf70
5
5
  SHA512:
6
- metadata.gz: cc9213ae6a6df339a195e81dbc9d7a8f6ecc98fe6072f5f824dd54bdd8659cf92d1bf932fcf42041ee04e6d99fa658f70116bbbf052daade3d83635c4b5a8613
7
- data.tar.gz: ab000b0cc5c59a24b46ef81e7f24cb27b78c6be6b826f597e132d03356f3524e37338c311596e22b6690942b618dcb0ff5f207fa762f5b622ec3d8ff3267058d
6
+ metadata.gz: 06632a862034f79eaca80df73925ff73e7e93c5d292942a11f735a2fa97d00422736b807ba9e6578b48a4b4613ce3e218dd243d33e493238178eb04ce4c19b01
7
+ data.tar.gz: 484ab260dd2cbc83889fc7fddc9f39ab197a52f882df3ea6ba71aea03834c889e6619b22f46821b3ea546d4e28475497d0af80800e0f634a2d26239bb61de7fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strum-service (0.1.0)
4
+ strum-service (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/strum/service.rb CHANGED
@@ -26,7 +26,7 @@ module Strum
26
26
  # Internal: Interactor class methods.
27
27
  module ClassMethods
28
28
  def call(main_input, **args, &block)
29
- new(main_input, args).execute(&block)
29
+ new(main_input, **args).execute(&block)
30
30
  end
31
31
  end
32
32
 
@@ -35,9 +35,10 @@ module Strum
35
35
  self.strum_errors = {}
36
36
  self.service_handlers = { on: {}, success: {}, failure: {} }
37
37
  self.outputs = {}
38
- main_input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
39
38
  self.inputs = args.merge(default: main_input)
40
39
  self._inputs = inputs.dup.freeze
40
+ setup_default_proc
41
+ setup_input_default_proc
41
42
  end
42
43
 
43
44
  def execute(&block)
@@ -74,9 +75,10 @@ module Strum
74
75
  end
75
76
 
76
77
  def method_missing(method_name, *args, &_block)
77
- super unless input.is_a?(Hash) && input[method_name.to_sym]
78
-
79
- args.count.positive? ? public_send(input[method_name.to_sym], args) : input[method_name.to_sym]
78
+ (args.count.zero? &&
79
+ (input.is_a?(Hash) && input[method_name.to_sym]) ||
80
+ inputs[method_name.to_sym]) ||
81
+ super
80
82
  end
81
83
 
82
84
  def respond_to_missing?(method_name, include_private = false)
@@ -182,6 +184,14 @@ module Strum
182
184
 
183
185
  private
184
186
 
187
+ def setup_default_proc
188
+ inputs.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
189
+ end
190
+
191
+ def setup_input_default_proc
192
+ input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil } if input.is_a?(Hash)
193
+ end
194
+
185
195
  def key_to_sym(key)
186
196
  key.to_sym
187
197
  rescue StandardError
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Strum
4
4
  module Service
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strum-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-05-10 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Strum Service
14
14
  email: