u-case 3.0.0.rc6 → 3.1.0

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: 1a1e5c36bfc65522732f2e00f8b57a2fe84bbe59a730cb85287f56de7850dea0
4
- data.tar.gz: 22bf46677b24e2f8fb6f3b060ba6bc348a7a8025556d1f3cf6ddf81d0e204279
3
+ metadata.gz: d3472991bd5b3d6198cb7455044ac8144445b61c860ce76ca191eba1f6e09aac
4
+ data.tar.gz: eebefecaa4a27d98f3a558aa17a1731de6639a69cc5011fc6acdf430a7e1f52b
5
5
  SHA512:
6
- metadata.gz: a6276a81c7e006d07922b2b30de0a066e1a9a2bc0856586287a35263e21f9c353d571fbf666a08348988c6f42ea893730008e77ea42f65867c801aa24bf19299
7
- data.tar.gz: 47e3482b444c3b9730a3cc5e37ca78bc26556454c1155045663e9b1c597203fc11584dbc7e6716fefaf093cfb8dbcd5f7db63b84b04d8bd5598e94b00c2dfb7c
6
+ metadata.gz: e8cc6cc9994b30bc71b3a5485123dcd41a5583c195bba9969da41e85efb6ebb964f4ee5e39d02f86e324a2cbea24b420f1a9fa67d1dca410c8a60539873d80b9
7
+ data.tar.gz: 48b7f05a0473dba7885d1907d794b503c44030de29b53e0fd757f71597e37c8d0248db980b071ae8f2492e207bfddb0616b25dd9acbefd219318114f72b73339
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='false' bundle exec rake test
7
+ ACTIVEMODEL_VERSION='3.2' ENABLE_TRANSITIONS='true' 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='false' bundle exec rake test
12
+ ACTIVEMODEL_VERSION='5.2' ENABLE_TRANSITIONS='true' 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='false' bundle exec rake test
18
+ ACTIVEMODEL_VERSION='6.0' ENABLE_TRANSITIONS='true' bundle exec rake test
16
19
  fi
17
20
 
18
21
  bundle update
19
- bundle exec rake test
22
+ ENABLE_TRANSITIONS='false' bundle exec rake test
23
+ ENABLE_TRANSITIONS='true' bundle exec rake test
data/Gemfile CHANGED
@@ -15,9 +15,17 @@ if activemodel_version < '6.1.0'
15
15
  gem 'activesupport', activemodel, require: false
16
16
  end
17
17
 
18
+ simplecov_version =
19
+ case RUBY_VERSION
20
+ when /\A2.[23]/ then '~> 0.17.1'
21
+ when /\A2.4/ then '~> 0.18.5'
22
+ else '~> 0.19'
23
+ end
24
+
18
25
  group :test do
19
26
  gem 'minitest', activemodel_version < '4.1' ? '~> 4.2' : '~> 5.0'
20
- gem 'simplecov', require: false
27
+
28
+ gem 'simplecov', simplecov_version, require: false
21
29
  end
22
30
 
23
31
  pry_byebug_version =
data/README.md CHANGED
@@ -1,12 +1,29 @@
1
- ![Ruby](https://img.shields.io/badge/ruby-2.2+-ruby.svg?colorA=99004d&colorB=cc0066)
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=main)](https://travis-ci.com/serradura/u-case)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability)](https://codeclimate.com/github/serradura/u-case/maintainability)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage)](https://codeclimate.com/github/serradura/u-case/test_coverage)
1
+ <p align="center">
2
+ <img src="./assets/ucase_logo_v1.png" alt="u-case - Create simple and powerful use cases as Ruby objects.">
6
3
 
7
- <img src="./assets/ucase_logo_v1.png" alt="u-case - Create simple and powerful use cases as Ruby objects.">
4
+ <p align="center"><i>Create simple and powerful use cases as Ruby objects.</i></p>
5
+ <br>
6
+ </p>
8
7
 
9
- Create simple and powerful use cases as Ruby objects.
8
+ <p align="center">
9
+ <img src="https://img.shields.io/badge/ruby-2.2+-ruby.svg?colorA=99004d&colorB=cc0066" alt="Ruby">
10
+
11
+ <a href="https://rubygems.org/gems/u-case">
12
+ <img alt="Gem" src="https://img.shields.io/gem/v/u-case.svg?style=flat-square">
13
+ </a>
14
+
15
+ <a href="https://travis-ci.com/serradura/u-case">
16
+ <img alt="Build Status" src="https://travis-ci.com/serradura/u-case.svg?branch=main">
17
+ </a>
18
+
19
+ <a href="https://codeclimate.com/github/serradura/u-case/maintainability">
20
+ <img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability">
21
+ </a>
22
+
23
+ <a href="https://codeclimate.com/github/serradura/u-case/test_coverage">
24
+ <img alt="Test Coverage" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage">
25
+ </a>
26
+ </p>
10
27
 
11
28
  The main project goals are:
12
29
  1. Easy to use and easy to learn (input **>>** process **>>** output).
@@ -21,7 +38,7 @@ The main project goals are:
21
38
 
22
39
  Version | Documentation
23
40
  --------- | -------------
24
- 3.0.0.rc5 | https://github.com/serradura/u-case/blob/main/README.md
41
+ 3.1.0 | https://github.com/serradura/u-case/blob/main/README.md
25
42
  2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
26
43
  1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
27
44
 
@@ -60,15 +77,15 @@ Version | Documentation
60
77
  - [`Kind::Validator`](#kindvalidator)
61
78
  - [`Micro::Case.config`](#microcaseconfig)
62
79
  - [Benchmarks](#benchmarks)
63
- - [`Micro::Case` (v3.0.0)](#microcase-v300)
80
+ - [`Micro::Case`](#microcase)
64
81
  - [Success results](#success-results)
65
82
  - [Failure results](#failure-results)
66
- - [`Micro::Cases::Flow` (v3.0.0)](#microcasesflow-v300)
83
+ - [`Micro::Cases::Flow`](#microcasesflow)
67
84
  - [Comparisons](#comparisons)
68
85
  - [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)
86
+ - [1️⃣ Users creation](#1️⃣-users-creation)
87
+ - [2️⃣ Rails App (API)](#2️⃣-rails-app-api)
88
+ - [3️⃣ CLI calculator](#3️⃣-cli-calculator)
72
89
  - [4️⃣ Rescuing exceptions inside of the use cases](#4️⃣-rescuing-exceptions-inside-of-the-use-cases)
73
90
  - [Development](#development)
74
91
  - [Contributing](#contributing)
@@ -79,7 +96,7 @@ Version | Documentation
79
96
 
80
97
  | u-case | branch | ruby | activemodel |
81
98
  | -------------- | ------- | -------- | ------------- |
82
- | 3.0.0.rc5 | main | >= 2.2.0 | >= 3.2, < 6.1 |
99
+ | 3.1.0 | main | >= 2.2.0 | >= 3.2, < 6.1 |
83
100
  | 2.6.0 | v2.x | >= 2.2.0 | >= 3.2, < 6.1 |
84
101
  | 1.1.0 | v1.x | >= 2.2.0 | >= 3.2, < 6.1 |
85
102
 
@@ -102,7 +119,7 @@ Version | Documentation
102
119
  Add this line to your application's Gemfile:
103
120
 
104
121
  ```ruby
105
- gem 'u-case', '~> 3.0.0.rc5'
122
+ gem 'u-case', '~> 3.1.0'
106
123
  ```
107
124
 
108
125
  And then execute:
@@ -1060,7 +1077,7 @@ class Multiply < Micro::Case
1060
1077
  validates :a, :b, presence: true, numericality: true
1061
1078
 
1062
1079
  def call!
1063
- return Failure :validation_error, result: { errors: self.errors } if invalid?
1080
+ return Failure :invalid_attributes, result: { errors: self.errors } if invalid?
1064
1081
 
1065
1082
  Success result: { number: a * b }
1066
1083
  end
@@ -1170,48 +1187,48 @@ end
1170
1187
 
1171
1188
  ## Benchmarks
1172
1189
 
1173
- ### `Micro::Case` (v3.0.0)
1190
+ ### `Micro::Case`
1174
1191
 
1175
1192
  #### Success results
1176
1193
 
1177
1194
  | Gem / Abstraction | Iterations per second | Comparison |
1178
1195
  | ----------------- | --------------------: | ----------------: |
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 |
1196
+ | Dry::Monads | 141730.1 | _**The Fastest**_ |
1197
+ | **Micro::Case** | 103541.3 | 1.37x slower |
1198
+ | Interactor | 29100.8 | 4.87x slower |
1199
+ | Trailblazer::Operation | 15031.4 | 9.43x slower |
1200
+ | Dry::Transaction | 5674.0 | 24.98x slower |
1184
1201
 
1185
1202
  <details>
1186
1203
  <summary>Show the full <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a> results.</summary>
1187
1204
 
1188
1205
  ```ruby
1189
1206
  # 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
1207
+ # Interactor 2.915k i/100ms
1208
+ # Trailblazer::Operation 1.543k i/100ms
1209
+ # Dry::Monads 14.288k i/100ms
1210
+ # Dry::Transaction 571.000 i/100ms
1211
+ # Micro::Case 10.418k i/100ms
1212
+ # Micro::Case::Strict 8.296k i/100ms
1213
+ # Micro::Case::Safe 10.254k i/100ms
1197
1214
 
1198
1215
  # 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
1216
+ # Interactor 29.101k (± 2.1%) i/s - 145.750k in 5.010660s
1217
+ # Trailblazer::Operation 15.031k2.0%) i/s - 75.607k in 5.032071s
1218
+ # Dry::Monads 141.730k (± 3.1%) i/s - 714.400k in 5.045546s
1219
+ # Dry::Transaction 5.674k1.9%) i/s - 28.550k in 5.033564s
1220
+ # Micro::Case 103.541k1.6%) i/s - 520.900k in 5.032077s
1221
+ # Micro::Case::Strict 83.045k2.4%) i/s - 423.096k in 5.098031s
1222
+ # Micro::Case::Safe 101.662k1.5%) i/s - 512.700k in 5.044386s
1206
1223
 
1207
1224
  # 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
1225
+ # Dry::Monads: 141730.1 i/s
1226
+ # Micro::Case: 103541.3 i/s - 1.37x (± 0.00) slower
1227
+ # Micro::Case::Safe: 101662.2 i/s - 1.39x (± 0.00) slower
1228
+ # Micro::Case::Strict: 83044.6 i/s - 1.71x (± 0.00) slower
1229
+ # Interactor: 29100.8 i/s - 4.87x (± 0.00) slower
1230
+ # Trailblazer::Operation: 15031.4 i/s - 9.43x (± 0.00) slower
1231
+ # Dry::Transaction: 5674.0 i/s - 24.98x (± 0.00) slower
1215
1232
  ```
1216
1233
  </details>
1217
1234
 
@@ -1221,42 +1238,42 @@ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_success_r
1221
1238
 
1222
1239
  | Gem / Abstraction | Iterations per second | Comparison |
1223
1240
  | ----------------- | --------------------: | ----------------: |
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 |
1241
+ | **Micro::Case** | 98820.8 | _**The Fastest**_ |
1242
+ | Dry::Monads | 71329.7 | 1.39x slower |
1243
+ | Trailblazer::Operation | 15034.9 | 6.57x slower |
1244
+ | Interactor | 13958.7 | 7.08x slower |
1245
+ | Dry::Transaction | 5067.5 | 19.50x slower |
1229
1246
 
1230
1247
  <details>
1231
1248
  <summary>Show the full <a href="https://github.com/evanphx/benchmark-ips">benchmark/ips</a> results.</summary>
1232
1249
 
1233
1250
  ```ruby
1234
1251
  # 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
1252
+ # Interactor 1.324k i/100ms
1253
+ # Trailblazer::Operation 1.525k i/100ms
1254
+ # Dry::Monads 7.126k i/100ms
1255
+ # Dry::Transaction 499.000 i/100ms
1256
+ # Micro::Case 9.919k i/100ms
1257
+ # Micro::Case::Strict 7.837k i/100ms
1258
+ # Micro::Case::Safe 9.762k i/100ms
1242
1259
 
1243
1260
  # 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
1261
+ # Interactor 13.959k2.5%) i/s - 70.172k in 5.030240s
1262
+ # Trailblazer::Operation 15.035k2.2%) i/s - 76.250k in 5.074108s
1263
+ # Dry::Monads 71.330k2.4%) i/s - 363.426k in 5.097993s
1264
+ # Dry::Transaction 5.068k1.9%) i/s - 25.449k in 5.023922s
1265
+ # Micro::Case 98.821k2.9%) i/s - 495.950k in 5.023421s
1266
+ # Micro::Case::Strict 79.936k (± 3.1%) i/s - 399.687k in 5.005435s
1267
+ # Micro::Case::Safe 98.695k1.9%) i/s - 497.862k in 5.046246s
1251
1268
 
1252
1269
  # 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
1270
+ # Micro::Case: 98820.8 i/s
1271
+ # Micro::Case::Safe: 98695.0 i/s - same-ish: difference falls within error
1272
+ # Micro::Case::Strict: 79935.9 i/s - 1.24x (± 0.00) slower
1273
+ # Dry::Monads: 71329.7 i/s - 1.39x (± 0.00) slower
1274
+ # Trailblazer::Operation: 15034.9 i/s - 6.57x (± 0.00) slower
1275
+ # Interactor: 13958.7 i/s - 7.08x (± 0.00) slower
1276
+ # Dry::Transaction: 5067.5 i/s - 19.50x (± 0.00) slower
1260
1277
  ```
1261
1278
  </details>
1262
1279
 
@@ -1264,15 +1281,16 @@ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_failure_r
1264
1281
 
1265
1282
  ---
1266
1283
 
1267
- ### `Micro::Cases::Flow` (v3.0.0)
1284
+ ### `Micro::Cases::Flow`
1268
1285
 
1269
1286
  | 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
1287
  | ------------------------------------------- | ----------------: | ----------------: |
1271
1288
  | 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 |
1289
+ | Micro::Case internal flow (through lambdas) | 1.03x slower | 1.04x slower |
1290
+ | Micro::Case `then` method | 1.49x slower | 0x slower |
1291
+ | Micro::Cases.flow | 1.53x slower | 1.04x slower |
1292
+ | Micro::Cases.safe_flow | 1.54x slower | 1.04x slower |
1293
+ | Interactor::Organizer | 2.05x slower | 6.27x slower |
1276
1294
 
1277
1295
  \* 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
1296
 
@@ -1281,25 +1299,40 @@ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_failure_r
1281
1299
 
1282
1300
  ```ruby
1283
1301
  # 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
1302
+ # Interactor::Organizer
1303
+ # 4.837k i/100ms
1304
+ # Micro::Cases.flow([])
1305
+ # 6.755k i/100ms
1306
+ # Micro::Cases::safe_flow([])
1307
+ # 6.809k i/100ms
1308
+ # Micro::Case flow using `then` method
1309
+ # 6.968k i/100ms
1310
+ # Micro::Case flow using private methods
1311
+ # 10.362k i/100ms
1312
+ # Micro::Case flow using private methods through lambdas
1313
+ # 10.258k i/100ms
1289
1314
 
1290
1315
  # 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
1316
+ # Interactor::Organizer
1317
+ # 50.731k (± 1.6%) i/s - 256.361k in 5.054694s
1318
+ # Micro::Cases.flow([])
1319
+ # 67.757k1.6%) i/s - 344.505k in 5.085681s
1320
+ # Micro::Cases::safe_flow([])
1321
+ # 67.613k (± 1.6%) i/s - 340.450k in 5.036562s
1322
+ # Micro::Case flow using `then` method
1323
+ # 69.483k (± 1.5%) i/s - 348.400k in 5.015351s
1324
+ # Micro::Case flow using private methods
1325
+ # 103.788k (± 1.0%) i/s - 528.462k in 5.092240s
1326
+ # Micro::Case flow using private methods through lambdas
1327
+ # 101.081k (± 1.2%) i/s - 512.900k in 5.074904s
1296
1328
 
1297
1329
  # 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
1330
+ # Micro::Case flow using private methods: 103787.5 i/s
1331
+ # Micro::Case flow using private methods through lambdas: 101080.6 i/s - 1.03x (± 0.00) slower
1332
+ # Micro::Case flow using `then` method: 69483.3 i/s - 1.49x (± 0.00) slower
1333
+ # Micro::Cases.flow([]): 67757.2 i/s - 1.53x (± 0.00) slower
1334
+ # Micro::Cases::safe_flow([]): 67613.3 i/s - 1.54x (± 0.00) slower
1335
+ # Interactor::Organizer: 50730.8 i/s - 2.05x (± 0.00) slower
1303
1336
  ```
1304
1337
  </details>
1305
1338
 
@@ -1308,25 +1341,39 @@ https://github.com/serradura/u-case/blob/main/benchmarks/use_case/with_failure_r
1308
1341
 
1309
1342
  ```ruby
1310
1343
  # 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
-
1344
+ # Interactor::Organizer
1345
+ # 2.299k i/100ms
1346
+ # Micro::Cases.flow([])
1347
+ # 14.187k i/100ms
1348
+ # Micro::Cases::safe_flow([])
1349
+ # 13.609k i/100ms
1350
+ # Micro::Case flow using `then` method
1351
+ # 14.578k i/100ms
1352
+ # Micro::Case flow using private methods
1353
+ # 14.101k i/100ms
1354
+ # Micro::Case flow using private methods through lambdas
1355
+ # 13.670k i/100ms
1317
1356
  # 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
1357
+ # Interactor::Organizer
1358
+ # 23.306k2.1%) i/s - 117.249k in 5.033171s
1359
+ # Micro::Cases.flow([])
1360
+ # 140.111k1.6%) i/s - 709.350k in 5.064041s
1361
+ # Micro::Cases::safe_flow([])
1362
+ # 139.927k (± 1.7%) i/s - 707.668k in 5.058971s
1363
+ # Micro::Case flow using `then` method
1364
+ # 146.073k (± 2.0%) i/s - 743.478k in 5.091741s
1365
+ # Micro::Case flow using private methods
1366
+ # 142.092k (± 1.5%) i/s - 719.151k in 5.062298s
1367
+ # Micro::Case flow using private methods through lambdas
1368
+ # 140.791k (± 1.2%) i/s - 710.840k in 5.049584s
1323
1369
 
1324
1370
  # 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
1371
+ # Micro::Case flow using `then` method: 146073.0 i/s
1372
+ # Micro::Case flow using private methods: 142091.7 i/s - same-ish: difference falls within error
1373
+ # Micro::Case flow using private methods through lambdas: 140791.1 i/s - 1.04x (± 0.00) slower
1374
+ # Micro::Cases.flow([]): 140110.8 i/s - 1.04x (± 0.00) slower
1375
+ # Micro::Cases::safe_flow([]): 139926.6 i/s - 1.04x (± 0.00) slower
1376
+ # Interactor::Organizer: 23305.9 i/s - 6.27x (± 0.00) slower
1330
1377
  ```
1331
1378
  </details>
1332
1379
 
@@ -1343,24 +1390,24 @@ Check it out implementations of the same use case with different gems/abstractio
1343
1390
 
1344
1391
  ## Examples
1345
1392
 
1346
- ### 1️⃣ Rails App (API)
1393
+ ### 1️⃣ Users creation
1394
+
1395
+ > 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.
1396
+ >
1397
+ > Link: https://github.com/serradura/u-case/blob/main/examples/users_creation
1398
+
1399
+ ### 2️⃣ Rails App (API)
1347
1400
 
1348
1401
  > 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.
1349
1402
  >
1350
1403
  > Link: https://github.com/serradura/from-fat-controllers-to-use-cases
1351
1404
 
1352
- ### 2️⃣ CLI calculator
1405
+ ### 3️⃣ CLI calculator
1353
1406
 
1354
1407
  > Rake tasks to demonstrate how to handle user data, and how to use different failure types to control the program flow.
1355
1408
  >
1356
1409
  > Link: https://github.com/serradura/u-case/tree/main/examples/calculator
1357
1410
 
1358
- ### 3️⃣ Users creation
1359
-
1360
- > An example of a use case flow that defines steps to sanitize, validate, and persist its input data.
1361
- >
1362
- > Link: https://github.com/serradura/u-case/blob/main/examples/users_creation.rb
1363
-
1364
1411
  ### 4️⃣ Rescuing exceptions inside of the use cases
1365
1412
 
1366
1413
  > Link: https://github.com/serradura/u-case/blob/main/examples/rescuing_exceptions.rb