use_cases 2.0.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3434ac25b743c9794d09774344e6e2af73e4b2077a2d7d0aef31628ffc4a75d
4
- data.tar.gz: de20ba12bb9a7ac43cf6bdb8ac35c96973de8b63f8cd90fee4b016e2e3459827
3
+ metadata.gz: 0e64ac5284a76952a2d0da6e2d48ea40b93af03926b5f4d0a23a38698836dfe0
4
+ data.tar.gz: b9c894909398b9cc287da875175f125319243b0dd077158d27b59e498e184cbe
5
5
  SHA512:
6
- metadata.gz: 8755ef9b16ab142c6fa1a2156f0c539d366195af5f065aa4b182dfa539fd973cb5d1f800d26c43c886f36bd8fa6c91e71955b612df229d4577b117b1455515a1
7
- data.tar.gz: 8c89294d590c86a6f6126e309ca4011839fb5c236269623493f319bd55424d1aef026010f3ae7723ff62d229deb9ecec83a0d94c7efdbfdce327b285486d698b
6
+ metadata.gz: a34740d4caa9274eeed8e76ebc20293c3dc1e962551b35b3c14b885e018135d51a7f27f832b9ca02b0639a6bf4e4e4febcf4567bd7ed6531077940e709f9e84f
7
+ data.tar.gz: 728d1da8f92f9d375b11172fc68f4b8aab7e4b9efa048a88959bd9996d327a27bda9432948fdd82d8dcae0fab05a64e4127efb343441b7d4f0e8e5b66d1ed31b
data/Gemfile.lock CHANGED
@@ -1,12 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- use_cases (2.0.0)
5
- activesupport
6
- dry-events
7
- dry-matcher
8
- dry-monads
9
- dry-validation
4
+ use_cases (2.0.3)
5
+ activesupport (>= 5.1)
6
+ dry-matcher (>= 0.8.1)
7
+ dry-monads (>= 1.0.0)
8
+ dry-validation (>= 0.11.0)
10
9
 
11
10
  GEM
12
11
  remote: https://rubygems.org/
data/lib/use_case.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry/monads"
4
- require "dry/events"
5
4
  require "dry/monads/do"
6
5
  require "dry/monads/do/all"
7
6
  require "dry/matcher/result_matcher"
data/lib/use_cases/dsl.rb CHANGED
@@ -14,6 +14,10 @@ module UseCases
14
14
  end
15
15
  end
16
16
 
17
+ def remove_step(name)
18
+ __steps__.delete_if { |step| step.name == name }
19
+ end
20
+
17
21
  def __steps__
18
22
  @__steps__ ||= []
19
23
  end
@@ -38,18 +38,17 @@ module UseCases
38
38
  raise StepArgumentError,
39
39
  "##{step.name} expects #{expected_args_count} arguments it only received #{step_args.count}, make sure your previous step Success() statement has a payload."
40
40
  end
41
-
42
41
  return args.first(callable_args_count) unless external? && selects_external_args?
43
42
 
44
43
  hashed_args(args).values
45
44
  end
46
45
 
47
- def hashed_args(args)
46
+ def hashed_args((prev_result, params, current_user))
48
47
  {
49
- params: args.first,
50
- current_user: args.last,
51
- previous_step_result: args.last
52
- }.slice(pass_option)
48
+ previous_step_result: prev_result,
49
+ params: params,
50
+ current_user: current_user,
51
+ }.slice(*pass_option)
53
52
  end
54
53
 
55
54
  def callable_proc
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UseCases
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.3"
5
5
  end
data/use_cases.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "A DSL to encapsulate your domain logic."
13
13
  spec.homepage = "https://github.com/listminut/use_cases"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.8"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/listminut/use_cases"
@@ -30,11 +30,10 @@ Gem::Specification.new do |spec|
30
30
  # For more information and examples about making a new gem, checkout our
31
31
  # guide at: https://bundler.io/guides/creating_gem.html
32
32
 
33
- spec.add_dependency "activesupport"
34
- spec.add_dependency "dry-events"
35
- spec.add_dependency "dry-matcher"
36
- spec.add_dependency "dry-monads"
37
- spec.add_dependency "dry-validation"
33
+ spec.add_dependency "activesupport", ">= 5.1"
34
+ spec.add_dependency "dry-matcher", ">= 0.8.1"
35
+ spec.add_dependency "dry-monads", ">= 1.0.0"
36
+ spec.add_dependency "dry-validation", ">= 0.11.0"
38
37
 
39
38
  spec.add_development_dependency "byebug"
40
39
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_cases
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ring Twice
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,70 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '5.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: dry-events
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: '5.1'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: dry-matcher
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: '0'
33
+ version: 0.8.1
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: '0'
40
+ version: 0.8.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: dry-monads
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '0'
47
+ version: 1.0.0
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: 1.0.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: dry-validation
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: 0.11.0
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: 0.11.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: byebug
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -197,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
183
  requirements:
198
184
  - - ">="
199
185
  - !ruby/object:Gem::Version
200
- version: 2.6.8
186
+ version: 2.6.0
201
187
  required_rubygems_version: !ruby/object:Gem::Requirement
202
188
  requirements:
203
189
  - - ">="