dry-mutations 0.8.11 → 0.8.12
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49ca2fa2417fe1742ed3fa35e912ac08a83cf30
|
4
|
+
data.tar.gz: c688fd3329e66ffeac44de2af98e01f4a5dc2e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccaea6b0d3b35983de61d2346d58f792a160e9cd5966be7f2206457fc4f26f08f70846431f64b454cddf796dbf5870568c4794b53d2d88cb2994b241d32f1a24
|
7
|
+
data.tar.gz: ebcb6185a4d5ae865acf1091faf1ce6fa3c67bc2770d8b95aa73b62ba42e56650b71f4fcb8920847fc9a631cacc659f6f78559a40727c6029641086a5a2abf56
|
@@ -4,7 +4,7 @@ module Dry
|
|
4
4
|
Container = lambda do |whatever|
|
5
5
|
return ->(*input) { input } unless whatever
|
6
6
|
whatever.respond_to?(:call) ? whatever : Utils.Constant(whatever).tap do |p|
|
7
|
-
fail ArgumentError, "The argument must respond to :call, though #{
|
7
|
+
fail ArgumentError, "The argument must respond to :call, though #{whatever.inspect} passed." unless p.respond_to? :call
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -10,13 +10,22 @@ module Dry
|
|
10
10
|
module DSL # :nodoc:
|
11
11
|
include Dry::Monads::Either::Mixin
|
12
12
|
|
13
|
+
def self.extended base
|
14
|
+
fail Errors::TypeError.new("Extended class [#{base}] should not respond to :call, it is defined by this extension.") if base.respond_to?(:call)
|
15
|
+
end
|
16
|
+
|
13
17
|
def chain **params
|
14
18
|
return enum_for(:chain) unless block_given? # FIXME: Needed? Works? Remove?
|
15
19
|
|
16
20
|
λ = Proc.new
|
17
21
|
|
18
|
-
::Dry.Transaction(container: ::Dry::Mutations::Transactions::Container, step_adapters: StepAdapters) do
|
22
|
+
@transaction = ::Dry.Transaction(container: ::Dry::Mutations::Transactions::Container, step_adapters: StepAdapters) do
|
19
23
|
instance_eval(&λ)
|
24
|
+
end.tap do |transaction|
|
25
|
+
singleton_class.send :define_method, :call do |input|
|
26
|
+
transaction.(input)
|
27
|
+
end
|
28
|
+
singleton_class.send(:alias_method, :run, :call) unless singleton_class.respond_to?(:run)
|
20
29
|
end
|
21
30
|
end
|
22
31
|
end
|