rails_use_case 0.0.8 → 0.0.9

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: 789a956d7cf0a8545c91465e9a664e44aa5ae79481127f954cf4e7a4b2b90ec4
4
- data.tar.gz: 9be655cf0d0c3e16c81ce8700af3b2952ba82e3b6a1dc2b28c87880ba8c6e281
3
+ metadata.gz: 56f84c351e857b7fd1ac1963d18138f96608376c4952fe3a12e8e7db2dbc0152
4
+ data.tar.gz: 46de14ac109e227a1a36dfdbb7f75a4e0595652c3d0e59189788cbbe8ea1ccd3
5
5
  SHA512:
6
- metadata.gz: 0a01d5e6930473a0140ce41ca2b0d6744c4bc4af1a9d425afe6416a639de96b40410a1d67c1858cb439d7813553a6edc32712754fd099d541cf81a6088c05e70
7
- data.tar.gz: 661ae29ab31c2b4b69b3843758c36e5bbab74392dfc621375aa6ac9cb835c15a1f3e83cb5af5e1c04720504593e1d7aff903d997e7d1235e6d68049e52ffe984
6
+ metadata.gz: 990f15747a27962ea59d7428416c8b525cf297e5e18f592fbaf3feeed8d4eecfe231bc7608acaa6516bc6273973ab651639a272c8b885f8b672fc4cb9b699ecf
7
+ data.tar.gz: '009f04d247c31452fec07815ff7be8c6af90ba3e5e03ef08f3ac4fd4b87cfcd4103cf44963ffc2a09f8791e8f9430327dd7db98f0d2e11d06feba3b646cbabd1'
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Rails Use Case gem
2
2
 
3
- Opinionated gem for UseCases and Services in rails to keep models and controllers slim.
3
+ Opinionated gem for UseCases and Services in Rails to keep your Models and Controllers slim.
4
+
5
+ Read more: https://dev.to/phortx/pimp-your-rails-application-32d0
4
6
 
5
7
  The purpose of a UseCase is to contain reusable high level business logic which would normally be
6
8
  located in the controller. Examples are: Place an item in the cart, create a new user or delete a comment.
@@ -20,7 +22,7 @@ gem 'rails_use_case'
20
22
 
21
23
  The purpose of a UseCase is to contain reusable high level business logic which would normally be
22
24
  located in the controller. It defines a process via `step` definitions. A UseCase takes params
23
- and has a outcome, which is successfully or failed. It doesn't have a configuration file and doesn't
25
+ and has a outcome, which is either successful or failed. It doesn't have a configuration file and doesn't
24
26
  log anything. Examples are: Place an item in the cart, create a new user or delete a comment.
25
27
 
26
28
  Steps are executed in the defined order. Only when a step succeeds (returns true) the next step will
@@ -83,6 +85,11 @@ puts result.inspect
83
85
  # }
84
86
  ```
85
87
 
88
+ - You can check whether a UseCase was successful via `result.success?`.
89
+ - You can access the value of `@record` via `result.record`.
90
+ - You can stop the UseCase process with a error message via throwing `Rails::UseCase::Error` exception.
91
+
92
+
86
93
 
87
94
  ## Behavior
88
95
 
@@ -8,8 +8,8 @@ module Rails
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  class_methods do
11
- def call(*args)
12
- new.call(*args)
11
+ def call(...)
12
+ new.call(...)
13
13
  end
14
14
 
15
15
  alias_method :perform, :call
data/lib/rails/service.rb CHANGED
@@ -121,8 +121,8 @@ module Rails
121
121
 
122
122
 
123
123
  # Allows call syntax on class level: SomeService.(some, args)
124
- def self.call(*args)
125
- new.(*args)
124
+ def self.call(...)
125
+ new.(...)
126
126
  end
127
127
 
128
128
  # Allows to use rails view helpers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_use_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Klein
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-05 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0
19
+ version: 6.1.0
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: 4.1.0
26
+ version: 6.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.0
33
+ version: 6.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.0
40
+ version: 6.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler-audit
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -195,7 +195,7 @@ homepage: https://github.com/phortx/rails-use-case
195
195
  licenses:
196
196
  - MIT
197
197
  metadata: {}
198
- post_install_message:
198
+ post_install_message:
199
199
  rdoc_options: []
200
200
  require_paths:
201
201
  - lib
@@ -210,8 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.0.3
214
- signing_key:
213
+ rubygems_version: 3.1.2
214
+ signing_key:
215
215
  specification_version: 4
216
216
  summary: Rails UseCase and Service classes
217
217
  test_files: []