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: 38e022b61eedee83ed6710525c92bb37aeda3313
4
- data.tar.gz: 4fa39a230fc3f8929247c425b2d29aba7e5675d0
3
+ metadata.gz: f49ca2fa2417fe1742ed3fa35e912ac08a83cf30
4
+ data.tar.gz: c688fd3329e66ffeac44de2af98e01f4a5dc2e01
5
5
  SHA512:
6
- metadata.gz: e15388ad39dbd46471f98658fd44f3e0f7724f5436c3c6abd9bf427c4eeec79e1ba35cb9befaf010e4650660d57fc633f6d223398504950ef22d06a1ee669d04
7
- data.tar.gz: 13f8351a663571f345892db471fe73acae4e1a4895a5b5cf3b0408409dc78728754401d5b52a3f82af8b5ab91ff22dfa1d47ea3b4e7f8fbf8e4428a730c390de
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 #{k.inspect} passed." unless p.respond_to? :call
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
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Mutations
3
- VERSION = '0.8.11'.freeze
3
+ VERSION = '0.8.12'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-mutations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin