activeinteractor 2.0.0.alpha.1.0.0 → 2.0.0.alpha.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_interactor/base.rb +19 -7
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b84d76be97bd543c4583c588b6f7dae50424c640fa675b7a4fb154bc8bdb1051
4
- data.tar.gz: c0846db96ac34ed824b79118395afea967e528f4b8eb797eb7411c156ddb5d55
3
+ metadata.gz: 2a13c3091acf37b48e249f912e5551da92b039e17920e53c1082ebcc4b34f4c2
4
+ data.tar.gz: 8e1e80f06675574384eeae45835f6372bf04d7378cdf64f7f21323d36857a7e4
5
5
  SHA512:
6
- metadata.gz: 2ce8f776d073318c6bfdc47e6d822febde4570aa4777eab9ff2096bac4e8162a5849e01b929f8ed4e33f04b45edeca018e9a7381e651a3ec1556b68826c2e891
7
- data.tar.gz: 822f52d219f12aaec5f373e1eed23f70568b3dd44972eda16f6a2c27f03fb1895b3566d605602448443db263765dae6e0b7a0c2e1dfdd0f61d0392c92c064977
6
+ metadata.gz: 6b006f6e815419f58a6b6f063d37db8beae1e1ad239d98635545bb267d2c09df9307ec80528c1785035013aeaf07f27a73fcd1668dac44115e466109da675910
7
+ data.tar.gz: 3f0d5b6fd50726ec6539b691257d00d85254e1ca74c06727d84da7763e8545d033650c6ec7482f307e622e77bff2bc8fcae25e54c2f6a15208377258dac1d814
@@ -7,8 +7,12 @@ module ActiveInteractor
7
7
  attributes[:arguments][name.to_sym] = { name: name, type: type, description: description }.merge(options)
8
8
  end
9
9
 
10
+ def perform!(input_context = {})
11
+ new(input_context).perform!
12
+ end
13
+
10
14
  def perform(input_context = {})
11
- new(input_context).send(:exec_perform!)
15
+ perform!(input_context)
12
16
  rescue Error => e
13
17
  e.result
14
18
  rescue StandardError => e
@@ -31,18 +35,26 @@ module ActiveInteractor
31
35
  @context = parse_input!
32
36
  end
33
37
 
34
- def perform; end
38
+ def perform!
39
+ interact
40
+ Result.success(data: parse_output!)
41
+ end
42
+
43
+ def perform
44
+ perform!
45
+ rescue Error => e
46
+ e.result
47
+ rescue StandardError => e
48
+ Result.failure(errors: e.message)
49
+ end
50
+
51
+ def interact; end
35
52
  def rollback; end
36
53
 
37
54
  protected
38
55
 
39
56
  attr_accessor :context
40
57
 
41
- def exec_perform!
42
- perform
43
- Result.success(data: parse_output!)
44
- end
45
-
46
58
  def fail!(errors = {})
47
59
  rollback
48
60
  raise Error, Result.failure(data: context, errors: errors)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeinteractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.1.0.0
4
+ version: 2.0.0.alpha.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Allen
@@ -72,9 +72,9 @@ licenses:
72
72
  - MIT
73
73
  metadata:
74
74
  bug_tracker_uri: https://github.com/activeinteractor/activeinteractor/issues
75
- changelog_uri: https://github.com/activeinteractor/activeinteractor/blob/v2.0.0-alpha.1.0.0/CHANGELOG.md
75
+ changelog_uri: https://github.com/activeinteractor/activeinteractor/blob/v2.0.0-alpha.2.0.0/CHANGELOG.md
76
76
  homepage_uri: https://github.com/activeinteractor/activeinteractor
77
- source_code_uri: https://github.com/activeinteractor/activeinteractor/tree/v2.0.0-alpha.1.0.0
77
+ source_code_uri: https://github.com/activeinteractor/activeinteractor/tree/v2.0.0-alpha.2.0.0
78
78
  wiki_uri: https://github.com/activeinteractor/activeinteractor/wiki
79
79
  rubygems_mfa_required: 'true'
80
80
  post_install_message: