u-case 3.0.0.rc5 → 3.0.0

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
  SHA256:
3
- metadata.gz: 12b63a467f7516217f29a5705859141be80fc2fb2209c41e77d7c8a365745b8c
4
- data.tar.gz: 4501314217a04cca7d56c0091a8a2c02f93f308f51c323462af36c71532be1b3
3
+ metadata.gz: 7fe9a88c0c01e52d2f89ba28578c4b67c8cd1d6e303a49ff1ce2d11e5e543159
4
+ data.tar.gz: a105e4f13e760d03e201a6d6246a0b39e96e0452465953ca0d1767e93d927711
5
5
  SHA512:
6
- metadata.gz: 85351b75b4e2e2e62e66f2dff078a607ffa29e5c0df93dc3f6ce07dbfd0444ecd3034358fc08b358698c7ca2ccd73dbc5b8ab597ce339c5d7f4970df504b8a99
7
- data.tar.gz: 5ef5552ca31fc9d9474f9a54717c7ce9a45ad9aba46710bf6671ae5836a492981beb4bee3cbdfbb5418770bcd896a634846eb659b5eaf1c098d6fa0c9339dc7b
6
+ metadata.gz: cfed6efdf05b4960bb63c43926cfb2aa6a35b394f665c9a1e472f2ebf05568d418bd04e4c075bea2c990e896131ba57281455ab9fc153d4d4ee4196773798ff4
7
+ data.tar.gz: 6573ad028e83794fa6851f15a27e3b96a1368d84345e1a8aede633c6f1962bde2ff20e0222bdad9c833dabbe22e90a190ea1c092ef8cab4258d443c9bf91f652
data/.travis.sh CHANGED
@@ -3,17 +3,21 @@
3
3
  ruby_v=$(ruby -v)
4
4
 
5
5
  ACTIVEMODEL_VERSION='3.2' bundle update
6
- ACTIVEMODEL_VERSION='3.2' bundle exec rake test
6
+ ACTIVEMODEL_VERSION='3.2' ENABLE_TRANSITIONS='true' bundle exec rake test
7
+ ACTIVEMODEL_VERSION='3.2' ENABLE_TRANSITIONS='false' bundle exec rake test
7
8
 
8
9
  if [[ ! $ruby_v =~ '2.2.0' ]]; then
9
10
  ACTIVEMODEL_VERSION='5.2' bundle update
10
- ACTIVEMODEL_VERSION='5.2' bundle exec rake test
11
+ ACTIVEMODEL_VERSION='5.2' ENABLE_TRANSITIONS='true' bundle exec rake test
12
+ ACTIVEMODEL_VERSION='5.2' ENABLE_TRANSITIONS='false' bundle exec rake test
11
13
  fi
12
14
 
13
15
  if [[ $ruby_v =~ '2.5.' ]] || [[ $ruby_v =~ '2.6.' ]] || [[ $ruby_v =~ '2.7.' ]]; then
14
16
  ACTIVEMODEL_VERSION='6.0' bundle update
15
- ACTIVEMODEL_VERSION='6.0' bundle exec rake test
17
+ ACTIVEMODEL_VERSION='6.0' ENABLE_TRANSITIONS='true' bundle exec rake test
18
+ ACTIVEMODEL_VERSION='6.0' ENABLE_TRANSITIONS='false' bundle exec rake test
16
19
  fi
17
20
 
18
21
  bundle update
19
- bundle exec rake test
22
+ ENABLE_TRANSITIONS='true' bundle exec rake test
23
+ ENABLE_TRANSITIONS='false' bundle exec rake test
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Ruby](https://img.shields.io/badge/ruby-2.2+-ruby.svg?colorA=99004d&colorB=cc0066)
2
2
  [![Gem](https://img.shields.io/gem/v/u-case.svg?style=flat-square)](https://rubygems.org/gems/u-case)
3
- [![Build Status](https://travis-ci.com/serradura/u-case.svg?branch=master)](https://travis-ci.com/serradura/u-case)
3
+ [![Build Status](https://travis-ci.com/serradura/u-case.svg?branch=main)](https://travis-ci.com/serradura/u-case)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability)](https://codeclimate.com/github/serradura/u-case/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage)](https://codeclimate.com/github/serradura/u-case/test_coverage)
6
6
 
@@ -21,7 +21,7 @@ The main project goals are:
21
21
 
22
22
  Version | Documentation
23
23
  --------- | -------------
24
- 3.0.0.rc5 | https://github.com/serradura/u-case/blob/master/README.md
24
+ 3.0.0 | https://github.com/serradura/u-case/blob/main/README.md
25
25
  2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
26
26
  1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
27
27
 
@@ -66,9 +66,9 @@ Version | Documentation
66
66
  - [`Micro::Cases::Flow` (v3.0.0)](#microcasesflow-v300)
67
67
  - [Comparisons](#comparisons)
68
68
  - [Examples](#examples)
69
- - [1️⃣ Rails App (API)](#1️⃣-rails-app-api)
70
- - [2️⃣ CLI calculator](#2️⃣-cli-calculator)
71
- - [3️⃣ Users creation](#3️⃣-users-creation)
69
+ - [1️⃣ Users creation](#1️⃣-users-creation)
70
+ - [2️⃣ Rails App (API)](#2️⃣-rails-app-api)
71
+ - [3️⃣ CLI calculator](#3️⃣-cli-calculator)
72
72
  - [4️⃣ Rescuing exceptions inside of the use cases](#4️⃣-rescuing-exceptions-inside-of-the-use-cases)
73
73
  - [Development](#development)
74
74
  - [Contributing](#contributing)
@@ -79,7 +79,7 @@ Version | Documentation
79
79
 
80
80
  | u-case | branch | ruby | activemodel |
81
81
  | -------------- | ------- | -------- | ------------- |
82
- | 3.0.0.rc5 | main | >= 2.2.0 | >= 3.2, < 6.1 |
82
+ | 3.0.0 | main | >= 2.2.0 | >= 3.2, < 6.1 |
83
83
  | 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 |
84
84
  | 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 |
85
85
 
@@ -102,7 +102,7 @@ Version | Documentation
102
102
  Add this line to your application's Gemfile:
103
103
 
104
104
  ```ruby
105
- gem 'u-case', '~> 3.0.0.rc5'
105
+ gem 'u-case', '~> 3.0.0'
106
106
  ```
107
107
 
108
108
  And then execute:
@@ -1060,7 +1060,7 @@ class Multiply < Micro::Case
1060
1060
  validates :a, :b, presence: true, numericality: true
1061
1061
 
1062
1062
  def call!
1063
- return Failure :validation_error, result: { errors: self.errors } if invalid?
1063
+ return Failure :invalid_attributes, result: { errors: self.errors } if invalid?
1064
1064
 
1065
1065
  Success result: { number: a * b }
1066
1066
  end
@@ -1176,103 +1176,104 @@ end
1176
1176
 
1177
1177
  | Gem / Abstraction | Iterations per second | Comparison |
1178
1178
  | ----------------- | --------------------: | ----------------: |
1179
- | Dry::Monads | 139037.7 | _**The Fastest**_ |
1180
- | **Micro::Case** | 101497.3 | 1.37x slower |
1181
- | Interactor | 30694.2 | 4.53x slower |
1182
- | Trailblazer::Operation | 14580.8 | 9.54x slower |
1183
- | Dry::Transaction | 5728.0 | 24.27x slower |
1179
+ | Dry::Monads | 141730.1 | _**The Fastest**_ |
1180
+ | **Micro::Case** | 103541.3 | 1.37x slower |
1181
+ | Interactor | 29100.8 | 4.87x slower |
1182
+ | Trailblazer::Operation | 15031.4 | 9.43x slower |
1183
+ | Dry::Transaction | 5674.0 | 24.98x slower |
1184
1184
 
1185
1185
  <details>
1186
1186
  <summary>Show the full <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a> results.</summary>
1187
1187
 
1188
1188
  ```ruby
1189
1189
  # Warming up --------------------------------------
1190
- # Interactor 3.056k i/100ms
1191
- # Trailblazer::Operation 1.480k i/100ms
1192
- # Dry::Monads 14.316k i/100ms
1193
- # Dry::Transaction 576.000 i/100ms
1194
- # Micro::Case 10.388k i/100ms
1195
- # Micro::Case::Strict 8.223k i/100ms
1196
- # Micro::Case::Safe 10.057k i/100ms
1190
+ # Interactor 2.915k i/100ms
1191
+ # Trailblazer::Operation 1.543k i/100ms
1192
+ # Dry::Monads 14.288k i/100ms
1193
+ # Dry::Transaction 571.000 i/100ms
1194
+ # Micro::Case 10.418k i/100ms
1195
+ # Micro::Case::Strict 8.296k i/100ms
1196
+ # Micro::Case::Safe 10.254k i/100ms
1197
1197
 
1198
1198
  # Calculating -------------------------------------
1199
- # Interactor 30.694k (± 2.3%) i/s - 155.856k in 5.080475s
1200
- # Trailblazer::Operation 14.581k3.9%) i/s - 74.000k in 5.083091s
1201
- # Dry::Monads 139.038k (± 3.0%) i/s - 701.484k in 5.049921s
1202
- # Dry::Transaction 5.728k3.6%) i/s - 28.800k in 5.034599s
1203
- # Micro::Case 100.712k3.4%) i/s - 509.012k in 5.060139s
1204
- # Micro::Case::Strict 81.513k3.4%) i/s - 411.150k in 5.049962s
1205
- # Micro::Case::Safe 101.497k3.1%) i/s - 512.907k in 5.058463s
1199
+ # Interactor 29.101k (± 2.1%) i/s - 145.750k in 5.010660s
1200
+ # Trailblazer::Operation 15.031k2.0%) i/s - 75.607k in 5.032071s
1201
+ # Dry::Monads 141.730k (± 3.1%) i/s - 714.400k in 5.045546s
1202
+ # Dry::Transaction 5.674k1.9%) i/s - 28.550k in 5.033564s
1203
+ # Micro::Case 103.541k1.6%) i/s - 520.900k in 5.032077s
1204
+ # Micro::Case::Strict 83.045k2.4%) i/s - 423.096k in 5.098031s
1205
+ # Micro::Case::Safe 101.662k1.5%) i/s - 512.700k in 5.044386s
1206
1206
 
1207
1207
  # Comparison:
1208
- # Dry::Monads: 139037.7 i/s
1209
- # Micro::Case::Safe: 101497.3 i/s - 1.37x (± 0.00) slower
1210
- # Micro::Case: 100711.6 i/s - 1.38x (± 0.00) slower
1211
- # Micro::Case::Strict: 81512.9 i/s - 1.71x (± 0.00) slower
1212
- # Interactor: 30694.2 i/s - 4.53x (± 0.00) slower
1213
- # Trailblazer::Operation: 14580.8 i/s - 9.54x (± 0.00) slower
1214
- # Dry::Transaction: 5728.0 i/s - 24.27x (± 0.00) slower
1208
+ # Dry::Monads: 141730.1 i/s
1209
+ # Micro::Case: 103541.3 i/s - 1.37x (± 0.00) slower
1210
+ # Micro::Case::Safe: 101662.2 i/s - 1.39x (± 0.00) slower
1211
+ # Micro::Case::Strict: 83044.6 i/s - 1.71x (± 0.00) slower
1212
+ # Interactor: 29100.8 i/s - 4.87x (± 0.00) slower
1213
+ # Trailblazer::Operation: 15031.4 i/s - 9.43x (± 0.00) slower
1214
+ # Dry::Transaction: 5674.0 i/s - 24.98x (± 0.00) slower
1215
1215
  ```
1216
1216
  </details>
1217
1217
 
1218
- https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_success_result.rb
1218
+ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_success_result.rb
1219
1219
 
1220
1220
  #### Failure results
1221
1221
 
1222
1222
  | Gem / Abstraction | Iterations per second | Comparison |
1223
1223
  | ----------------- | --------------------: | ----------------: |
1224
- | **Micro::Case** | 94619.6 | _**The Fastest**_ |
1225
- | Dry::Monads | 70250.6 | 1.35x slower |
1226
- | Trailblazer::Operation | 14786.1 | 6.40x slower |
1227
- | Interactor | 13770.0 | 6.87x slower |
1228
- | Dry::Transaction | 4994.4 | 18.95x slower |
1224
+ | **Micro::Case** | 98820.8 | _**The Fastest**_ |
1225
+ | Dry::Monads | 71329.7 | 1.39x slower |
1226
+ | Trailblazer::Operation | 15034.9 | 6.57x slower |
1227
+ | Interactor | 13958.7 | 7.08x slower |
1228
+ | Dry::Transaction | 5067.5 | 19.50x slower |
1229
1229
 
1230
1230
  <details>
1231
1231
  <summary>Show the full <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a> results.</summary>
1232
1232
 
1233
1233
  ```ruby
1234
1234
  # Warming up --------------------------------------
1235
- # Interactor 1.408k i/100ms
1236
- # Trailblazer::Operation 1.492k i/100ms
1237
- # Dry::Monads 7.224k i/100ms
1238
- # Dry::Transaction 501.000 i/100ms
1239
- # Micro::Case 9.664k i/100ms
1240
- # Micro::Case::Strict 7.823k i/100ms
1241
- # Micro::Case::Safe 9.464k i/100ms
1235
+ # Interactor 1.324k i/100ms
1236
+ # Trailblazer::Operation 1.525k i/100ms
1237
+ # Dry::Monads 7.126k i/100ms
1238
+ # Dry::Transaction 499.000 i/100ms
1239
+ # Micro::Case 9.919k i/100ms
1240
+ # Micro::Case::Strict 7.837k i/100ms
1241
+ # Micro::Case::Safe 9.762k i/100ms
1242
1242
 
1243
1243
  # Calculating -------------------------------------
1244
- # Interactor 13.770k4.3%) i/s - 68.992k in 5.020330s
1245
- # Trailblazer::Operation 14.786k5.3%) i/s - 74.600k in 5.064700s
1246
- # Dry::Monads 70.251k6.7%) i/s - 353.976k in 5.063010s
1247
- # Dry::Transaction 4.994k4.0%) i/s - 25.050k in 5.023997s
1248
- # Micro::Case 94.620k3.8%) i/s - 473.536k in 5.012483s
1249
- # Micro::Case::Strict 76.059k (± 3.0%) i/s - 383.327k in 5.044482s
1250
- # Micro::Case::Safe 91.719k5.6%) i/s - 463.736k in 5.072552s
1244
+ # Interactor 13.959k2.5%) i/s - 70.172k in 5.030240s
1245
+ # Trailblazer::Operation 15.035k2.2%) i/s - 76.250k in 5.074108s
1246
+ # Dry::Monads 71.330k2.4%) i/s - 363.426k in 5.097993s
1247
+ # Dry::Transaction 5.068k1.9%) i/s - 25.449k in 5.023922s
1248
+ # Micro::Case 98.821k2.9%) i/s - 495.950k in 5.023421s
1249
+ # Micro::Case::Strict 79.936k (± 3.1%) i/s - 399.687k in 5.005435s
1250
+ # Micro::Case::Safe 98.695k1.9%) i/s - 497.862k in 5.046246s
1251
1251
 
1252
1252
  # Comparison:
1253
- # Micro::Case: 94619.6 i/s
1254
- # Micro::Case::Safe: 91719.4 i/s - same-ish: difference falls within error
1255
- # Micro::Case::Strict: 76058.7 i/s - 1.24x (± 0.00) slower
1256
- # Dry::Monads: 70250.6 i/s - 1.35x (± 0.00) slower
1257
- # Trailblazer::Operation: 14786.1 i/s - 6.40x (± 0.00) slower
1258
- # Interactor: 13770.0 i/s - 6.87x (± 0.00) slower
1259
- # Dry::Transaction: 4994.4 i/s - 18.95x (± 0.00) slower
1253
+ # Micro::Case: 98820.8 i/s
1254
+ # Micro::Case::Safe: 98695.0 i/s - same-ish: difference falls within error
1255
+ # Micro::Case::Strict: 79935.9 i/s - 1.24x (± 0.00) slower
1256
+ # Dry::Monads: 71329.7 i/s - 1.39x (± 0.00) slower
1257
+ # Trailblazer::Operation: 15034.9 i/s - 6.57x (± 0.00) slower
1258
+ # Interactor: 13958.7 i/s - 7.08x (± 0.00) slower
1259
+ # Dry::Transaction: 5067.5 i/s - 19.50x (± 0.00) slower
1260
1260
  ```
1261
1261
  </details>
1262
1262
 
1263
- https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure_result.rb
1263
+ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_failure_result.rb
1264
1264
 
1265
1265
  ---
1266
1266
 
1267
1267
  ### `Micro::Cases::Flow` (v3.0.0)
1268
1268
 
1269
- | Gems / Abstraction | [Success results](https://github.com/serradura/u-case/blob/master/benchmarks/flow/with_success_result.rb#L40) | [Failure results](https://github.com/serradura/u-case/blob/master/benchmarks/flow/with_failure_result.rb#L40) |
1269
+ | Gems / Abstraction | [Success results](https://github.com/serradura/u-case/blob/main/benchmarks/flow/with_success_result.rb#L40) | [Failure results](https://github.com/serradura/u-case/blob/main/benchmarks/flow/with_failure_result.rb#L40) |
1270
1270
  | ------------------------------------------- | ----------------: | ----------------: |
1271
1271
  | Micro::Case internal flow (private methods) | _**The Fastest**_ | _**The Fastest**_ |
1272
- | Micro::Case `then` method | 1.48x slower | 0x slower |
1273
- | Micro::Cases.flow | 1.62x slower | 1.16x slower |
1274
- | Micro::Cases.safe_flow | 1.64x slower | 1.16x slower |
1275
- | Interactor::Organizer | 1.95x slower | 6.17x slower |
1272
+ | Micro::Case internal flow (through lambdas) | 1.03x slower | 1.04x slower |
1273
+ | Micro::Case `then` method | 1.49x slower | 0x slower |
1274
+ | Micro::Cases.flow | 1.53x slower | 1.04x slower |
1275
+ | Micro::Cases.safe_flow | 1.54x slower | 1.04x slower |
1276
+ | Interactor::Organizer | 2.05x slower | 6.27x slower |
1276
1277
 
1277
1278
  \* The `Dry::Monads`, `Dry::Transaction`, `Trailblazer::Operation` gems are out of this analysis because all of them doesn't have this kind of feature.
1278
1279
 
@@ -1281,25 +1282,40 @@ https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure
1281
1282
 
1282
1283
  ```ruby
1283
1284
  # Warming up --------------------------------------
1284
- # Interactor::Organizer 5.219k i/100ms
1285
- # Micro::Cases.flow([]) 6.451k i/100ms
1286
- # Micro::Cases::safe_flow([]) 6.421k i/100ms
1287
- # Micro::Case flow using `then` method 7.139k i/100ms
1288
- # Micro::Case flow using private methods 10.355k i/100ms
1285
+ # Interactor::Organizer
1286
+ # 4.837k i/100ms
1287
+ # Micro::Cases.flow([])
1288
+ # 6.755k i/100ms
1289
+ # Micro::Cases::safe_flow([])
1290
+ # 6.809k i/100ms
1291
+ # Micro::Case flow using `then` method
1292
+ # 6.968k i/100ms
1293
+ # Micro::Case flow using private methods
1294
+ # 10.362k i/100ms
1295
+ # Micro::Case flow using private methods through lambdas
1296
+ # 10.258k i/100ms
1289
1297
 
1290
1298
  # Calculating -------------------------------------
1291
- # Interactor::Organizer 52.959k (± 1.7%) i/s - 266.169k in 5.027332s
1292
- # Micro::Cases.flow([]) 63.947k (± 1.7%) i/s - 322.550k in 5.045597s
1293
- # Micro::Cases::safe_flow([]) 63.047k (± 3.1%) i/s - 321.050k in 5.097228s
1294
- # Micro::Case flow using `then` method 69.644k4.0%) i/s - 349.811k in 5.031120s
1295
- # Micro::Case flow using private methods 103.297k (± 1.4%) i/s - 517.750k in 5.013254s
1299
+ # Interactor::Organizer
1300
+ # 50.731k (± 1.6%) i/s - 256.361k in 5.054694s
1301
+ # Micro::Cases.flow([])
1302
+ # 67.757k1.6%) i/s - 344.505k in 5.085681s
1303
+ # Micro::Cases::safe_flow([])
1304
+ # 67.613k (± 1.6%) i/s - 340.450k in 5.036562s
1305
+ # Micro::Case flow using `then` method
1306
+ # 69.483k (± 1.5%) i/s - 348.400k in 5.015351s
1307
+ # Micro::Case flow using private methods
1308
+ # 103.788k (± 1.0%) i/s - 528.462k in 5.092240s
1309
+ # Micro::Case flow using private methods through lambdas
1310
+ # 101.081k (± 1.2%) i/s - 512.900k in 5.074904s
1296
1311
 
1297
1312
  # Comparison:
1298
- # Micro::Case flow using private methods: 103297.4 i/s
1299
- # Micro::Case flow using `then` method: 69644.0 i/s - 1.48x (± 0.00) slower
1300
- # Micro::Cases.flow([]): 63946.7 i/s - 1.62x (± 0.00) slower
1301
- # Micro::Cases::safe_flow([]): 63047.2 i/s - 1.64x (± 0.00) slower
1302
- # Interactor::Organizer: 52958.9 i/s - 1.95x (± 0.00) slower
1313
+ # Micro::Case flow using private methods: 103787.5 i/s
1314
+ # Micro::Case flow using private methods through lambdas: 101080.6 i/s - 1.03x (± 0.00) slower
1315
+ # Micro::Case flow using `then` method: 69483.3 i/s - 1.49x (± 0.00) slower
1316
+ # Micro::Cases.flow([]): 67757.2 i/s - 1.53x (± 0.00) slower
1317
+ # Micro::Cases::safe_flow([]): 67613.3 i/s - 1.54x (± 0.00) slower
1318
+ # Interactor::Organizer: 50730.8 i/s - 2.05x (± 0.00) slower
1303
1319
  ```
1304
1320
  </details>
1305
1321
 
@@ -1308,62 +1324,76 @@ https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure
1308
1324
 
1309
1325
  ```ruby
1310
1326
  # Warming up --------------------------------------
1311
- # Interactor::Organizer 2.381k i/100ms
1312
- # Micro::Cases.flow([]) 12.003k i/100ms
1313
- # Micro::Cases::safe_flow([]) 12.771k i/100ms
1314
- # Micro::Case flow using `then` method 15.085k i/100ms
1315
- # Micro::Case flow using private methods 14.254k i/100ms
1316
-
1327
+ # Interactor::Organizer
1328
+ # 2.299k i/100ms
1329
+ # Micro::Cases.flow([])
1330
+ # 14.187k i/100ms
1331
+ # Micro::Cases::safe_flow([])
1332
+ # 13.609k i/100ms
1333
+ # Micro::Case flow using `then` method
1334
+ # 14.578k i/100ms
1335
+ # Micro::Case flow using private methods
1336
+ # 14.101k i/100ms
1337
+ # Micro::Case flow using private methods through lambdas
1338
+ # 13.670k i/100ms
1317
1339
  # Calculating -------------------------------------
1318
- # Interactor::Organizer 23.579k (± 3.2%) i/s - 119.050k in 5.054410s
1319
- # Micro::Cases.flow([]) 124.072k3.4%) i/s - 624.156k in 5.036618s
1320
- # Micro::Cases::safe_flow([]) 124.894k (± 3.6%) i/s - 625.779k in 5.017494s
1321
- # Micro::Case flow using `then` method 145.370k4.8%) i/s - 739.165k in 5.096972s
1322
- # Micro::Case flow using private methods 139.753k (± 5.6%) i/s - 698.446k in 5.015207s
1340
+ # Interactor::Organizer
1341
+ # 23.306k2.1%) i/s - 117.249k in 5.033171s
1342
+ # Micro::Cases.flow([])
1343
+ # 140.111k1.6%) i/s - 709.350k in 5.064041s
1344
+ # Micro::Cases::safe_flow([])
1345
+ # 139.927k (± 1.7%) i/s - 707.668k in 5.058971s
1346
+ # Micro::Case flow using `then` method
1347
+ # 146.073k (± 2.0%) i/s - 743.478k in 5.091741s
1348
+ # Micro::Case flow using private methods
1349
+ # 142.092k (± 1.5%) i/s - 719.151k in 5.062298s
1350
+ # Micro::Case flow using private methods through lambdas
1351
+ # 140.791k (± 1.2%) i/s - 710.840k in 5.049584s
1323
1352
 
1324
1353
  # Comparison:
1325
- # Micro::Case flow using `then` method: 145369.7 i/s
1326
- # Micro::Case flow using private methods: 139753.4 i/s - same-ish: difference falls within error
1327
- # Micro::Cases::safe_flow([]): 124893.7 i/s - 1.16x (± 0.00) slower
1328
- # Micro::Cases.flow([]): 124071.8 i/s - 1.17x (± 0.00) slower
1329
- # Interactor::Organizer: 23578.7 i/s - 6.17x (± 0.00) slower
1354
+ # Micro::Case flow using `then` method: 146073.0 i/s
1355
+ # Micro::Case flow using private methods: 142091.7 i/s - same-ish: difference falls within error
1356
+ # Micro::Case flow using private methods through lambdas: 140791.1 i/s - 1.04x (± 0.00) slower
1357
+ # Micro::Cases.flow([]): 140110.8 i/s - 1.04x (± 0.00) slower
1358
+ # Micro::Cases::safe_flow([]): 139926.6 i/s - 1.04x (± 0.00) slower
1359
+ # Interactor::Organizer: 23305.9 i/s - 6.27x (± 0.00) slower
1330
1360
  ```
1331
1361
  </details>
1332
1362
 
1333
- https://github.com/serradura/u-case/tree/master/benchmarks/flow
1363
+ https://github.com/serradura/u-case/tree/main/benchmarks/flow
1334
1364
 
1335
1365
  ### Comparisons
1336
1366
 
1337
1367
  Check it out implementations of the same use case with different gems/abstractions.
1338
1368
 
1339
- * [interactor](https://github.com/serradura/u-case/blob/master/comparisons/interactor.rb)
1340
- * [u-case](https://github.com/serradura/u-case/blob/master/comparisons/u-case.rb)
1369
+ * [interactor](https://github.com/serradura/u-case/blob/main/comparisons/interactor.rb)
1370
+ * [u-case](https://github.com/serradura/u-case/blob/main/comparisons/u-case.rb)
1341
1371
 
1342
1372
  [⬆️ Back to Top](#table-of-contents-)
1343
1373
 
1344
1374
  ## Examples
1345
1375
 
1346
- ### 1️⃣ Rails App (API)
1376
+ ### 1️⃣ Users creation
1347
1377
 
1348
- > This project shows different kinds of architecture (one per commit), and in the last one, how to use the `Micro::Case` gem to handle the application business logic.
1378
+ > An example of a flow that defines steps to sanitize, validate, and persist its input data. It has all possible approaches to represent use cases using the `u-case` gem.
1349
1379
  >
1350
- > Link: https://github.com/serradura/from-fat-controllers-to-use-cases
1380
+ > Link: https://github.com/serradura/u-case/blob/main/examples/users_creation
1351
1381
 
1352
- ### 2️⃣ CLI calculator
1382
+ ### 2️⃣ Rails App (API)
1353
1383
 
1354
- > Rake tasks to demonstrate how to handle user data, and how to use different failure types to control the program flow.
1384
+ > This project shows different kinds of architecture (one per commit), and in the last one, how to use the `Micro::Case` gem to handle the application business logic.
1355
1385
  >
1356
- > Link: https://github.com/serradura/u-case/tree/master/examples/calculator
1386
+ > Link: https://github.com/serradura/from-fat-controllers-to-use-cases
1357
1387
 
1358
- ### 3️⃣ Users creation
1388
+ ### 3️⃣ CLI calculator
1359
1389
 
1360
- > An example of a use case flow that defines steps to sanitize, validate, and persist its input data.
1390
+ > Rake tasks to demonstrate how to handle user data, and how to use different failure types to control the program flow.
1361
1391
  >
1362
- > Link: https://github.com/serradura/u-case/blob/master/examples/users_creation.rb
1392
+ > Link: https://github.com/serradura/u-case/tree/main/examples/calculator
1363
1393
 
1364
1394
  ### 4️⃣ Rescuing exceptions inside of the use cases
1365
1395
 
1366
- > Link: https://github.com/serradura/u-case/blob/master/examples/rescuing_exceptions.rb
1396
+ > Link: https://github.com/serradura/u-case/blob/main/examples/rescuing_exceptions.rb
1367
1397
 
1368
1398
  [⬆️ Back to Top](#table-of-contents-)
1369
1399
 
@@ -1383,4 +1413,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
1383
1413
 
1384
1414
  ## Code of Conduct
1385
1415
 
1386
- Everyone interacting in the Micro::Case project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/serradura/u-case/blob/master/CODE_OF_CONDUCT.md).
1416
+ Everyone interacting in the Micro::Case project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/serradura/u-case/blob/main/CODE_OF_CONDUCT.md).
@@ -1,6 +1,6 @@
1
1
  ![Ruby](https://img.shields.io/badge/ruby-2.2+-ruby.svg?colorA=99004d&colorB=cc0066)
2
2
  [![Gem](https://img.shields.io/gem/v/u-case.svg?style=flat-square)](https://rubygems.org/gems/u-case)
3
- [![Build Status](https://travis-ci.com/serradura/u-case.svg?branch=master)](https://travis-ci.com/serradura/u-case)
3
+ [![Build Status](https://travis-ci.com/serradura/u-case.svg?branch=main)](https://travis-ci.com/serradura/u-case)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability)](https://codeclimate.com/github/serradura/u-case/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage)](https://codeclimate.com/github/serradura/u-case/test_coverage)
6
6
 
@@ -21,7 +21,7 @@ Principais objetivos deste projeto:
21
21
 
22
22
  Versão | Documentação
23
23
  --------- | -------------
24
- 3.0.0.rc5 | https://github.com/serradura/u-case/blob/master/README.md
24
+ 3.0.0 | https://github.com/serradura/u-case/blob/main/README.md
25
25
  2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
26
26
  1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
27
27
 
@@ -34,7 +34,7 @@ Versão | Documentação
34
34
  - [`Micro::Case::Result` - O que é o resultado de um caso de uso?](#microcaseresult---o-que-é-o-resultado-de-um-caso-de-uso)
35
35
  - [O que são os tipos de resultados?](#o-que-são-os-tipos-de-resultados)
36
36
  - [Como difinir tipos customizados de resultados?](#como-difinir-tipos-customizados-de-resultados)
37
- - [É possíve definir um tipo sem definit os dados do resultado?](#é-possíve-definir-um-tipo-sem-definit-os-dados-do-resultado)
37
+ - [É possível definir um tipo sem definir os dados do resultado?](#é-possível-definir-um-tipo-sem-definir-os-dados-do-resultado)
38
38
  - [Como utilizar os hooks dos resultados?](#como-utilizar-os-hooks-dos-resultados)
39
39
  - [Por que o hook sem um tipo definido expõe o próprio resultado?](#por-que-o-hook-sem-um-tipo-definido-expõe-o-próprio-resultado)
40
40
  - [Usando decomposição para acessar os dados e tipo do resultado](#usando-decomposição-para-acessar-os-dados-e-tipo-do-resultado)
@@ -65,9 +65,9 @@ Versão | Documentação
65
65
  - [`Micro::Cases::Flow` (v3.0.0)](#microcasesflow-v300)
66
66
  - [Comparações](#comparações)
67
67
  - [Exemplos](#exemplos)
68
- - [1️⃣ Rails App (API)](#1️⃣-rails-app-api)
69
- - [2️⃣ CLI calculator](#2️⃣-cli-calculator)
70
- - [3️⃣ Criação de usuários](#3️⃣-criação-de-usuários)
68
+ - [1️⃣ Criação de usuários](#1️⃣-criação-de-usuários)
69
+ - [2️⃣ Rails App (API)](#2️⃣-rails-app-api)
70
+ - [3️⃣ CLI calculator](#3️⃣-cli-calculator)
71
71
  - [4️⃣ Interceptando exceções dentro dos casos de uso](#4️⃣-interceptando-exceções-dentro-dos-casos-de-uso)
72
72
  - [Desenvolvimento](#desenvolvimento)
73
73
  - [Contribuindo](#contribuindo)
@@ -78,7 +78,7 @@ Versão | Documentação
78
78
 
79
79
  | u-case | branch | ruby | activemodel |
80
80
  | -------------- | ------- | -------- | ------------- |
81
- | 3.0.0.rc5 | main | >= 2.2.0 | >= 3.2, < 6.1 |
81
+ | 3.0.0 | main | >= 2.2.0 | >= 3.2, < 6.1 |
82
82
  | 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 |
83
83
  | 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 |
84
84
 
@@ -101,7 +101,7 @@ Versão | Documentação
101
101
  Adicione essa linha ao Gemfile da sua aplicação:
102
102
 
103
103
  ```ruby
104
- gem 'u-case', '~> 3.0.0.rc5'
104
+ gem 'u-case', '~> 3.0.0'
105
105
  ```
106
106
 
107
107
  E então execute:
@@ -276,7 +276,7 @@ bad_result.failure? # true
276
276
 
277
277
  [⬆️ Voltar para o índice](#índice-)
278
278
 
279
- #### É possíve definir um tipo sem definit os dados do resultado?
279
+ #### É possível definir um tipo sem definir os dados do resultado?
280
280
 
281
281
  Resposta: Sim, é possível. Mas isso terá um comportamento especial por conta dos dados do resultado ser um hash com o tipo definido como chave e `true` como o valor.
282
282
 
@@ -1064,7 +1064,7 @@ class Multiply < Micro::Case
1064
1064
  validates :a, :b, presence: true, numericality: true
1065
1065
 
1066
1066
  def call!
1067
- return Failure :validation_error, result: { errors: self.errors } if invalid?
1067
+ return Failure :invalid_attributes, result: { errors: self.errors } if invalid?
1068
1068
 
1069
1069
  Success result: { number: a * b }
1070
1070
  end
@@ -1180,103 +1180,104 @@ end
1180
1180
 
1181
1181
  | Gem / Abstração | Iterações por segundo | Comparação |
1182
1182
  | ----------------- | --------------------: | ----------------: |
1183
- | Dry::Monads | 139037.7 | _**O mais rápido**_ |
1184
- | **Micro::Case** | 101497.3 | 1.37x slower |
1185
- | Interactor | 30694.2 | 4.53x slower |
1186
- | Trailblazer::Operation | 14580.8 | 9.54x slower |
1187
- | Dry::Transaction | 5728.0 | 24.27x slower |
1183
+ | Dry::Monads | 141730.1 | _**O mais rápido**_ |
1184
+ | **Micro::Case** | 103541.3 | 1.37x slower |
1185
+ | Interactor | 29100.8 | 4.87x slower |
1186
+ | Trailblazer::Operation | 15031.4 | 9.43x slower |
1187
+ | Dry::Transaction | 5674.0 | 24.98x slower |
1188
1188
 
1189
1189
  <details>
1190
1190
  <summary>Show the full <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a> results.</summary>
1191
1191
 
1192
1192
  ```ruby
1193
1193
  # Warming up --------------------------------------
1194
- # Interactor 3.056k i/100ms
1195
- # Trailblazer::Operation 1.480k i/100ms
1196
- # Dry::Monads 14.316k i/100ms
1197
- # Dry::Transaction 576.000 i/100ms
1198
- # Micro::Case 10.388k i/100ms
1199
- # Micro::Case::Strict 8.223k i/100ms
1200
- # Micro::Case::Safe 10.057k i/100ms
1194
+ # Interactor 2.915k i/100ms
1195
+ # Trailblazer::Operation 1.543k i/100ms
1196
+ # Dry::Monads 14.288k i/100ms
1197
+ # Dry::Transaction 571.000 i/100ms
1198
+ # Micro::Case 10.418k i/100ms
1199
+ # Micro::Case::Strict 8.296k i/100ms
1200
+ # Micro::Case::Safe 10.254k i/100ms
1201
1201
 
1202
1202
  # Calculating -------------------------------------
1203
- # Interactor 30.694k (± 2.3%) i/s - 155.856k in 5.080475s
1204
- # Trailblazer::Operation 14.581k3.9%) i/s - 74.000k in 5.083091s
1205
- # Dry::Monads 139.038k (± 3.0%) i/s - 701.484k in 5.049921s
1206
- # Dry::Transaction 5.728k3.6%) i/s - 28.800k in 5.034599s
1207
- # Micro::Case 100.712k3.4%) i/s - 509.012k in 5.060139s
1208
- # Micro::Case::Strict 81.513k3.4%) i/s - 411.150k in 5.049962s
1209
- # Micro::Case::Safe 101.497k3.1%) i/s - 512.907k in 5.058463s
1203
+ # Interactor 29.101k (± 2.1%) i/s - 145.750k in 5.010660s
1204
+ # Trailblazer::Operation 15.031k2.0%) i/s - 75.607k in 5.032071s
1205
+ # Dry::Monads 141.730k (± 3.1%) i/s - 714.400k in 5.045546s
1206
+ # Dry::Transaction 5.674k1.9%) i/s - 28.550k in 5.033564s
1207
+ # Micro::Case 103.541k1.6%) i/s - 520.900k in 5.032077s
1208
+ # Micro::Case::Strict 83.045k2.4%) i/s - 423.096k in 5.098031s
1209
+ # Micro::Case::Safe 101.662k1.5%) i/s - 512.700k in 5.044386s
1210
1210
 
1211
1211
  # Comparison:
1212
- # Dry::Monads: 139037.7 i/s
1213
- # Micro::Case::Safe: 101497.3 i/s - 1.37x (± 0.00) slower
1214
- # Micro::Case: 100711.6 i/s - 1.38x (± 0.00) slower
1215
- # Micro::Case::Strict: 81512.9 i/s - 1.71x (± 0.00) slower
1216
- # Interactor: 30694.2 i/s - 4.53x (± 0.00) slower
1217
- # Trailblazer::Operation: 14580.8 i/s - 9.54x (± 0.00) slower
1218
- # Dry::Transaction: 5728.0 i/s - 24.27x (± 0.00) slower
1212
+ # Dry::Monads: 141730.1 i/s
1213
+ # Micro::Case: 103541.3 i/s - 1.37x (± 0.00) slower
1214
+ # Micro::Case::Safe: 101662.2 i/s - 1.39x (± 0.00) slower
1215
+ # Micro::Case::Strict: 83044.6 i/s - 1.71x (± 0.00) slower
1216
+ # Interactor: 29100.8 i/s - 4.87x (± 0.00) slower
1217
+ # Trailblazer::Operation: 15031.4 i/s - 9.43x (± 0.00) slower
1218
+ # Dry::Transaction: 5674.0 i/s - 24.98x (± 0.00) slower
1219
1219
  ```
1220
1220
  </details>
1221
1221
 
1222
- https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_success_result.rb
1222
+ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_success_result.rb
1223
1223
 
1224
1224
  #### Failure results
1225
1225
 
1226
1226
  | Gem / Abstração | Iterações por segundo | Comparação |
1227
1227
  | ----------------- | --------------------: | ----------------: |
1228
- | **Micro::Case** | 94619.6 | _**O mais rápido**_ |
1229
- | Dry::Monads | 70250.6 | 1.35x slower |
1230
- | Trailblazer::Operation | 14786.1 | 6.40x slower |
1231
- | Interactor | 13770.0 | 6.87x slower |
1232
- | Dry::Transaction | 4994.4 | 18.95x slower |
1228
+ | **Micro::Case** | 98820.8 | _**O mais rápido**_ |
1229
+ | Dry::Monads | 71329.7 | 1.39x slower |
1230
+ | Trailblazer::Operation | 15034.9 | 6.57x slower |
1231
+ | Interactor | 13958.7 | 7.08x slower |
1232
+ | Dry::Transaction | 5067.5 | 19.50x slower |
1233
1233
 
1234
1234
  <details>
1235
1235
  <summary>Mostrar o resultado completo do <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a>.</summary>
1236
1236
 
1237
1237
  ```ruby
1238
1238
  # Warming up --------------------------------------
1239
- # Interactor 1.408k i/100ms
1240
- # Trailblazer::Operation 1.492k i/100ms
1241
- # Dry::Monads 7.224k i/100ms
1242
- # Dry::Transaction 501.000 i/100ms
1243
- # Micro::Case 9.664k i/100ms
1244
- # Micro::Case::Strict 7.823k i/100ms
1245
- # Micro::Case::Safe 9.464k i/100ms
1239
+ # Interactor 1.324k i/100ms
1240
+ # Trailblazer::Operation 1.525k i/100ms
1241
+ # Dry::Monads 7.126k i/100ms
1242
+ # Dry::Transaction 499.000 i/100ms
1243
+ # Micro::Case 9.919k i/100ms
1244
+ # Micro::Case::Strict 7.837k i/100ms
1245
+ # Micro::Case::Safe 9.762k i/100ms
1246
1246
 
1247
1247
  # Calculating -------------------------------------
1248
- # Interactor 13.770k4.3%) i/s - 68.992k in 5.020330s
1249
- # Trailblazer::Operation 14.786k5.3%) i/s - 74.600k in 5.064700s
1250
- # Dry::Monads 70.251k6.7%) i/s - 353.976k in 5.063010s
1251
- # Dry::Transaction 4.994k4.0%) i/s - 25.050k in 5.023997s
1252
- # Micro::Case 94.620k3.8%) i/s - 473.536k in 5.012483s
1253
- # Micro::Case::Strict 76.059k (± 3.0%) i/s - 383.327k in 5.044482s
1254
- # Micro::Case::Safe 91.719k5.6%) i/s - 463.736k in 5.072552s
1248
+ # Interactor 13.959k2.5%) i/s - 70.172k in 5.030240s
1249
+ # Trailblazer::Operation 15.035k2.2%) i/s - 76.250k in 5.074108s
1250
+ # Dry::Monads 71.330k2.4%) i/s - 363.426k in 5.097993s
1251
+ # Dry::Transaction 5.068k1.9%) i/s - 25.449k in 5.023922s
1252
+ # Micro::Case 98.821k2.9%) i/s - 495.950k in 5.023421s
1253
+ # Micro::Case::Strict 79.936k (± 3.1%) i/s - 399.687k in 5.005435s
1254
+ # Micro::Case::Safe 98.695k1.9%) i/s - 497.862k in 5.046246s
1255
1255
 
1256
1256
  # Comparison:
1257
- # Micro::Case: 94619.6 i/s
1258
- # Micro::Case::Safe: 91719.4 i/s - same-ish: difference falls within error
1259
- # Micro::Case::Strict: 76058.7 i/s - 1.24x (± 0.00) slower
1260
- # Dry::Monads: 70250.6 i/s - 1.35x (± 0.00) slower
1261
- # Trailblazer::Operation: 14786.1 i/s - 6.40x (± 0.00) slower
1262
- # Interactor: 13770.0 i/s - 6.87x (± 0.00) slower
1263
- # Dry::Transaction: 4994.4 i/s - 18.95x (± 0.00) slower
1257
+ # Micro::Case: 98820.8 i/s
1258
+ # Micro::Case::Safe: 98695.0 i/s - same-ish: difference falls within error
1259
+ # Micro::Case::Strict: 79935.9 i/s - 1.24x (± 0.00) slower
1260
+ # Dry::Monads: 71329.7 i/s - 1.39x (± 0.00) slower
1261
+ # Trailblazer::Operation: 15034.9 i/s - 6.57x (± 0.00) slower
1262
+ # Interactor: 13958.7 i/s - 7.08x (± 0.00) slower
1263
+ # Dry::Transaction: 5067.5 i/s - 19.50x (± 0.00) slower
1264
1264
  ```
1265
1265
  </details>
1266
1266
 
1267
- https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure_result.rb
1267
+ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_failure_result.rb
1268
1268
 
1269
1269
  ---
1270
1270
 
1271
1271
  ### `Micro::Cases::Flow` (v3.0.0)
1272
1272
 
1273
- | Gem / Abstração | [Resultados de sucesso](https://github.com/serradura/u-case/blob/master/benchmarks/flow/with_success_result.rb#L40) | [Resultados de falha](https://github.com/serradura/u-case/blob/master/benchmarks/flow/with_failure_result.rb#L40) |
1273
+ | Gem / Abstração | [Resultados de sucesso](https://github.com/serradura/u-case/blob/main/benchmarks/flow/with_success_result.rb#L40) | [Resultados de falha](https://github.com/serradura/u-case/blob/main/benchmarks/flow/with_failure_result.rb#L40) |
1274
1274
  | ------------------------------------------- | ----------------: | ----------------: |
1275
1275
  | Micro::Case internal flow (private methods) | _**O mais rápido**_ | _**O mais rápido**_ |
1276
- | Micro::Case `then` method | 1.48x slower | 0x slower |
1277
- | Micro::Cases.flow | 1.62x slower | 1.16x slower |
1278
- | Micro::Cases.safe_flow | 1.64x slower | 1.16x slower |
1279
- | Interactor::Organizer | 1.95x slower | 6.17x slower |
1276
+ | Micro::Case internal flow (through lambdas) | 1.03x slower | 1.04x slower |
1277
+ | Micro::Case `then` method | 1.49x slower | 0x slower |
1278
+ | Micro::Cases.flow | 1.53x slower | 1.04x slower |
1279
+ | Micro::Cases.safe_flow | 1.54x slower | 1.04x slower |
1280
+ | Interactor::Organizer | 2.05x slower | 6.27x slower |
1280
1281
 
1281
1282
  \* As gems `Dry::Monads`, `Dry::Transaction`, `Trailblazer::Operation` estão fora desta análise por não terem esse tipo de funcionalidade.
1282
1283
 
@@ -1285,25 +1286,40 @@ https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure
1285
1286
 
1286
1287
  ```ruby
1287
1288
  # Warming up --------------------------------------
1288
- # Interactor::Organizer 5.219k i/100ms
1289
- # Micro::Cases.flow([]) 6.451k i/100ms
1290
- # Micro::Cases::safe_flow([]) 6.421k i/100ms
1291
- # Micro::Case flow using `then` method 7.139k i/100ms
1292
- # Micro::Case flow using private methods 10.355k i/100ms
1289
+ # Interactor::Organizer
1290
+ # 4.837k i/100ms
1291
+ # Micro::Cases.flow([])
1292
+ # 6.755k i/100ms
1293
+ # Micro::Cases::safe_flow([])
1294
+ # 6.809k i/100ms
1295
+ # Micro::Case flow using `then` method
1296
+ # 6.968k i/100ms
1297
+ # Micro::Case flow using private methods
1298
+ # 10.362k i/100ms
1299
+ # Micro::Case flow using private methods through lambdas
1300
+ # 10.258k i/100ms
1293
1301
 
1294
1302
  # Calculating -------------------------------------
1295
- # Interactor::Organizer 52.959k (± 1.7%) i/s - 266.169k in 5.027332s
1296
- # Micro::Cases.flow([]) 63.947k (± 1.7%) i/s - 322.550k in 5.045597s
1297
- # Micro::Cases::safe_flow([]) 63.047k (± 3.1%) i/s - 321.050k in 5.097228s
1298
- # Micro::Case flow using `then` method 69.644k4.0%) i/s - 349.811k in 5.031120s
1299
- # Micro::Case flow using private methods 103.297k (± 1.4%) i/s - 517.750k in 5.013254s
1303
+ # Interactor::Organizer
1304
+ # 50.731k (± 1.6%) i/s - 256.361k in 5.054694s
1305
+ # Micro::Cases.flow([])
1306
+ # 67.757k1.6%) i/s - 344.505k in 5.085681s
1307
+ # Micro::Cases::safe_flow([])
1308
+ # 67.613k (± 1.6%) i/s - 340.450k in 5.036562s
1309
+ # Micro::Case flow using `then` method
1310
+ # 69.483k (± 1.5%) i/s - 348.400k in 5.015351s
1311
+ # Micro::Case flow using private methods
1312
+ # 103.788k (± 1.0%) i/s - 528.462k in 5.092240s
1313
+ # Micro::Case flow using private methods through lambdas
1314
+ # 101.081k (± 1.2%) i/s - 512.900k in 5.074904s
1300
1315
 
1301
1316
  # Comparison:
1302
- # Micro::Case flow using private methods: 103297.4 i/s
1303
- # Micro::Case flow using `then` method: 69644.0 i/s - 1.48x (± 0.00) slower
1304
- # Micro::Cases.flow([]): 63946.7 i/s - 1.62x (± 0.00) slower
1305
- # Micro::Cases::safe_flow([]): 63047.2 i/s - 1.64x (± 0.00) slower
1306
- # Interactor::Organizer: 52958.9 i/s - 1.95x (± 0.00) slower
1317
+ # Micro::Case flow using private methods: 103787.5 i/s
1318
+ # Micro::Case flow using private methods through lambdas: 101080.6 i/s - 1.03x (± 0.00) slower
1319
+ # Micro::Case flow using `then` method: 69483.3 i/s - 1.49x (± 0.00) slower
1320
+ # Micro::Cases.flow([]): 67757.2 i/s - 1.53x (± 0.00) slower
1321
+ # Micro::Cases::safe_flow([]): 67613.3 i/s - 1.54x (± 0.00) slower
1322
+ # Interactor::Organizer: 50730.8 i/s - 2.05x (± 0.00) slower
1307
1323
  ```
1308
1324
  </details>
1309
1325
 
@@ -1312,62 +1328,76 @@ https://github.com/serradura/u-case/blob/master/benchmarks/use_case/with_failure
1312
1328
 
1313
1329
  ```ruby
1314
1330
  # Warming up --------------------------------------
1315
- # Interactor::Organizer 2.381k i/100ms
1316
- # Micro::Cases.flow([]) 12.003k i/100ms
1317
- # Micro::Cases::safe_flow([]) 12.771k i/100ms
1318
- # Micro::Case flow using `then` method 15.085k i/100ms
1319
- # Micro::Case flow using private methods 14.254k i/100ms
1320
-
1331
+ # Interactor::Organizer
1332
+ # 2.299k i/100ms
1333
+ # Micro::Cases.flow([])
1334
+ # 14.187k i/100ms
1335
+ # Micro::Cases::safe_flow([])
1336
+ # 13.609k i/100ms
1337
+ # Micro::Case flow using `then` method
1338
+ # 14.578k i/100ms
1339
+ # Micro::Case flow using private methods
1340
+ # 14.101k i/100ms
1341
+ # Micro::Case flow using private methods through lambdas
1342
+ # 13.670k i/100ms
1321
1343
  # Calculating -------------------------------------
1322
- # Interactor::Organizer 23.579k (± 3.2%) i/s - 119.050k in 5.054410s
1323
- # Micro::Cases.flow([]) 124.072k3.4%) i/s - 624.156k in 5.036618s
1324
- # Micro::Cases::safe_flow([]) 124.894k (± 3.6%) i/s - 625.779k in 5.017494s
1325
- # Micro::Case flow using `then` method 145.370k4.8%) i/s - 739.165k in 5.096972s
1326
- # Micro::Case flow using private methods 139.753k (± 5.6%) i/s - 698.446k in 5.015207s
1344
+ # Interactor::Organizer
1345
+ # 23.306k2.1%) i/s - 117.249k in 5.033171s
1346
+ # Micro::Cases.flow([])
1347
+ # 140.111k1.6%) i/s - 709.350k in 5.064041s
1348
+ # Micro::Cases::safe_flow([])
1349
+ # 139.927k (± 1.7%) i/s - 707.668k in 5.058971s
1350
+ # Micro::Case flow using `then` method
1351
+ # 146.073k (± 2.0%) i/s - 743.478k in 5.091741s
1352
+ # Micro::Case flow using private methods
1353
+ # 142.092k (± 1.5%) i/s - 719.151k in 5.062298s
1354
+ # Micro::Case flow using private methods through lambdas
1355
+ # 140.791k (± 1.2%) i/s - 710.840k in 5.049584s
1327
1356
 
1328
1357
  # Comparison:
1329
- # Micro::Case flow using `then` method: 145369.7 i/s
1330
- # Micro::Case flow using private methods: 139753.4 i/s - same-ish: difference falls within error
1331
- # Micro::Cases::safe_flow([]): 124893.7 i/s - 1.16x (± 0.00) slower
1332
- # Micro::Cases.flow([]): 124071.8 i/s - 1.17x (± 0.00) slower
1333
- # Interactor::Organizer: 23578.7 i/s - 6.17x (± 0.00) slower
1358
+ # Micro::Case flow using `then` method: 146073.0 i/s
1359
+ # Micro::Case flow using private methods: 142091.7 i/s - same-ish: difference falls within error
1360
+ # Micro::Case flow using private methods through lambdas: 140791.1 i/s - 1.04x (± 0.00) slower
1361
+ # Micro::Cases.flow([]): 140110.8 i/s - 1.04x (± 0.00) slower
1362
+ # Micro::Cases::safe_flow([]): 139926.6 i/s - 1.04x (± 0.00) slower
1363
+ # Interactor::Organizer: 23305.9 i/s - 6.27x (± 0.00) slower
1334
1364
  ```
1335
1365
  </details>
1336
1366
 
1337
- https://github.com/serradura/u-case/tree/master/benchmarks/flow
1367
+ https://github.com/serradura/u-case/tree/main/benchmarks/flow
1338
1368
 
1339
1369
  ### Comparações
1340
1370
 
1341
1371
  Confira as implementações do mesmo caso de uso com diferentes gems/abstrações.
1342
1372
 
1343
- * [interactor](https://github.com/serradura/u-case/blob/master/comparisons/interactor.rb)
1344
- * [u-case](https://github.com/serradura/u-case/blob/master/comparisons/u-case.rb)
1373
+ * [interactor](https://github.com/serradura/u-case/blob/main/comparisons/interactor.rb)
1374
+ * [u-case](https://github.com/serradura/u-case/blob/main/comparisons/u-case.rb)
1345
1375
 
1346
1376
  [⬆️ Voltar para o índice](#índice-)
1347
1377
 
1348
1378
  ## Exemplos
1349
1379
 
1350
- ### 1️⃣ Rails App (API)
1380
+ ### 1️⃣ Criação de usuários
1351
1381
 
1352
- > Este projeto mostra diferentes tipos de arquitetura (uma por commit), e na última, como usar a gem `Micro::Case` para lidar com a lógica de negócios da aplicação.
1382
+ > Um exemplo de fluxo que define etapas para higienizar, validar e persistir seus dados de entrada. Ele tem todas as abordagens possíveis para representar casos de uso com a gem `u-case`.
1353
1383
  >
1354
- > Link: https://github.com/serradura/from-fat-controllers-to-use-cases
1384
+ > Link: https://github.com/serradura/u-case/blob/main/examples/users_creation
1355
1385
 
1356
- ### 2️⃣ CLI calculator
1386
+ ### 2️⃣ Rails App (API)
1357
1387
 
1358
- > Rake tasks para demonstrar como lidar com os dados do usuário e como usar diferentes tipos de falha para controlar o fluxo do programa.
1388
+ > Este projeto mostra diferentes tipos de arquitetura (uma por commit), e na última, como usar a gem `Micro::Case` para lidar com a lógica de negócios da aplicação.
1359
1389
  >
1360
- > Link: https://github.com/serradura/u-case/tree/master/examples/calculator
1390
+ > Link: https://github.com/serradura/from-fat-controllers-to-use-cases
1361
1391
 
1362
- ### 3️⃣ Criação de usuários
1392
+ ### 3️⃣ CLI calculator
1363
1393
 
1364
- > Um exemplo de fluxo de caso de uso que define etapas para higienizar, validar e persistir seus dados de entrada.
1394
+ > Rake tasks para demonstrar como lidar com os dados do usuário e como usar diferentes tipos de falha para controlar o fluxo do programa.
1365
1395
  >
1366
- > Link: https://github.com/serradura/u-case/blob/master/examples/users_creation.rb
1396
+ > Link: https://github.com/serradura/u-case/tree/main/examples/calculator
1367
1397
 
1368
1398
  ### 4️⃣ Interceptando exceções dentro dos casos de uso
1369
1399
 
1370
- > Link: https://github.com/serradura/u-case/blob/master/examples/rescuing_exceptions.rb
1400
+ > Link: https://github.com/serradura/u-case/blob/main/examples/rescuing_exceptions.rb
1371
1401
 
1372
1402
  [⬆️ Voltar para o índice](#índice-)
1373
1403
 
@@ -1387,4 +1417,4 @@ A gem está disponível como código aberto nos termos da [licença MIT](https:/
1387
1417
 
1388
1418
  ## Código de conduta
1389
1419
 
1390
- Espera-se que todos que interagem com o codebase do projeto `Micro::Case`, issue trackers, chat rooms and mailing lists sigam o [código de conduta](https://github.com/serradura/u-case/blob/master/CODE_OF_CONDUCT.md).
1420
+ Espera-se que todos que interagem com o codebase do projeto `Micro::Case`, issue trackers, chat rooms and mailing lists sigam o [código de conduta](https://github.com/serradura/u-case/blob/main/CODE_OF_CONDUCT.md).