yaso 1.0.0pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +29 -0
- data/.ruby-version +1 -0
- data/.simplecov +8 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +12 -0
- data/benchmark/Gemfile +12 -0
- data/benchmark/index.rb +27 -0
- data/benchmark/shared/active_interaction_service.rb +4 -0
- data/benchmark/shared/callable_step.rb +7 -0
- data/benchmark/shared/decouplio_service.rb +4 -0
- data/benchmark/shared/interactor_service.rb +9 -0
- data/benchmark/shared/pure_service.rb +13 -0
- data/benchmark/shared/trailblazer_service.rb +4 -0
- data/benchmark/shared/yaso_service.rb +4 -0
- data/benchmark/step/active_interaction.rb +89 -0
- data/benchmark/step/benchmark.rb +31 -0
- data/benchmark/step/decouplio.rb +77 -0
- data/benchmark/step/interactor.rb +75 -0
- data/benchmark/step/pure.rb +73 -0
- data/benchmark/step/trailblazer.rb +84 -0
- data/benchmark/step/yaso.rb +67 -0
- data/lefthook.yml +5 -0
- data/lib/yaso/context.rb +36 -0
- data/lib/yaso/errors.rb +23 -0
- data/lib/yaso/invokable.rb +29 -0
- data/lib/yaso/logic/base.rb +29 -0
- data/lib/yaso/logic/classic.rb +56 -0
- data/lib/yaso/logic/failure.rb +12 -0
- data/lib/yaso/logic/pass.rb +12 -0
- data/lib/yaso/logic/step.rb +17 -0
- data/lib/yaso/logic/step_builder.rb +67 -0
- data/lib/yaso/logic/switch.rb +19 -0
- data/lib/yaso/logic/wrap.rb +22 -0
- data/lib/yaso/logic.rb +14 -0
- data/lib/yaso/service.rb +19 -0
- data/lib/yaso/stepable.rb +24 -0
- data/lib/yaso/version.rb +5 -0
- data/lib/yaso.rb +11 -0
- metadata +252 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4b9f4c5896548a6f409962b677761c4be496098d9dea767e3d5cfedfa7b18d96
|
4
|
+
data.tar.gz: ae9a8cb0cd3053da2c8f8255965f56038fc95d7d47e77b276186855d277bd97c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aec771273ca907c668f9c6153c6d3446b4e8fd80875f3812bebc7590ae1d7be7c7f4b080cc2ff0b9861beaf868a10fa1b4a878fb782658f62bc03d9da231828b
|
7
|
+
data.tar.gz: e1e9f17b4715e3bf6792de67be5562f5c495b61c57e7c20bbb3d2e0f4585290fb803bd6686821e74ad6c5982c0cb7f3c88363947b2981a650394d1023ffcca90
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-performance
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.5
|
7
|
+
SuggestExtensions: false
|
8
|
+
NewCops: enable
|
9
|
+
Exclude:
|
10
|
+
- vendor/bundle/**/*
|
11
|
+
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Metrics/BlockLength:
|
22
|
+
Exclude:
|
23
|
+
- '*.gemspec'
|
24
|
+
IgnoredMethods:
|
25
|
+
- describe
|
26
|
+
- context
|
27
|
+
|
28
|
+
RSpec/LetSetup:
|
29
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.2
|
data/.simplecov
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
yaso (1.0.0pre)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
docile (1.4.0)
|
13
|
+
ffaker (2.21.0)
|
14
|
+
lefthook (1.0.5)
|
15
|
+
method_source (1.0.0)
|
16
|
+
parallel (1.22.1)
|
17
|
+
parser (3.1.2.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
pry (0.14.1)
|
20
|
+
coderay (~> 1.1)
|
21
|
+
method_source (~> 1.0)
|
22
|
+
rainbow (3.1.1)
|
23
|
+
rake (13.0.6)
|
24
|
+
regexp_parser (2.5.0)
|
25
|
+
rexml (3.2.5)
|
26
|
+
rspec (3.11.0)
|
27
|
+
rspec-core (~> 3.11.0)
|
28
|
+
rspec-expectations (~> 3.11.0)
|
29
|
+
rspec-mocks (~> 3.11.0)
|
30
|
+
rspec-core (3.11.0)
|
31
|
+
rspec-support (~> 3.11.0)
|
32
|
+
rspec-expectations (3.11.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.11.0)
|
35
|
+
rspec-mocks (3.11.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.11.0)
|
38
|
+
rspec-support (3.11.0)
|
39
|
+
rubocop (1.28.2)
|
40
|
+
parallel (~> 1.10)
|
41
|
+
parser (>= 3.1.0.0)
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
43
|
+
regexp_parser (>= 1.8, < 3.0)
|
44
|
+
rexml
|
45
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
46
|
+
ruby-progressbar (~> 1.7)
|
47
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
48
|
+
rubocop-ast (1.17.0)
|
49
|
+
parser (>= 3.1.1.0)
|
50
|
+
rubocop-performance (1.13.3)
|
51
|
+
rubocop (>= 1.7.0, < 2.0)
|
52
|
+
rubocop-ast (>= 0.4.0)
|
53
|
+
rubocop-rspec (2.10.0)
|
54
|
+
rubocop (~> 1.19)
|
55
|
+
ruby-progressbar (1.11.0)
|
56
|
+
simplecov (0.21.2)
|
57
|
+
docile (~> 1.1)
|
58
|
+
simplecov-html (~> 0.11)
|
59
|
+
simplecov_json_formatter (~> 0.1)
|
60
|
+
simplecov-html (0.12.3)
|
61
|
+
simplecov_json_formatter (0.1.4)
|
62
|
+
unicode-display_width (2.2.0)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
x86_64-darwin-21
|
66
|
+
x86_64-linux
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
ffaker (~> 2.21.0)
|
70
|
+
lefthook (~> 1.0.5)
|
71
|
+
pry (~> 0.14.1)
|
72
|
+
rake (~> 13.0.6)
|
73
|
+
rspec (~> 3.11.0)
|
74
|
+
rubocop (>= 1.28.2, < 1.29.0)
|
75
|
+
rubocop-ast (>= 1.17.0, < 1.18.0)
|
76
|
+
rubocop-performance (>= 1.13.3, < 1.14.0)
|
77
|
+
rubocop-rspec (>= 2.10.0, < 2.11.0)
|
78
|
+
simplecov (~> 0.21.2)
|
79
|
+
yaso!
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
2.3.19
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Artem Shevchenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Yaso
|
2
|
+
[![Ruby](https://github.com/Ar2emis/yaso/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/Ar2emis/yaso/actions/workflows/main.yml) ![gem](https://img.shields.io/gem/v/yaso) [![GitHub license](https://img.shields.io/github/license/Ar2emis/yaso)](https://github.com/Ar2emis/yaso/blob/master/LICENSE.txt)
|
3
|
+
|
4
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yaso`. To experiment with that code, run `bin/console` for an interactive prompt.
|
5
|
+
|
6
|
+
TODO: Delete this and the text above, and describe your gem
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'yaso'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle install
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install yaso
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
TODO: Write usage instructions here
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yaso.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/benchmark/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gem 'benchmark-ips', '~> 2.10.0'
|
6
|
+
gem 'interactor', '~> 3.1.2'
|
7
|
+
gem 'kalibera', '~> 0.1.2'
|
8
|
+
gem 'trailblazer', '~> 2.1.0'
|
9
|
+
|
10
|
+
gem 'active_interaction', %w[2.5 2.6].any? { |version| RUBY_VERSION.include?(version) } ? '~> 4.1.0' : '~> 5.1.0'
|
11
|
+
|
12
|
+
RUBY_VERSION.include?('2.5') || gem('decouplio', '~> 1.0.0alpha8')
|
data/benchmark/index.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
|
5
|
+
require_relative '../lib/yaso'
|
6
|
+
|
7
|
+
require 'benchmark/ips'
|
8
|
+
RUBY_VERSION.include?('2.5') || require('decouplio')
|
9
|
+
require 'interactor'
|
10
|
+
require 'active_interaction'
|
11
|
+
require 'trailblazer'
|
12
|
+
|
13
|
+
require_relative 'shared/yaso_service'
|
14
|
+
RUBY_VERSION.include?('2.5') || require_relative('shared/decouplio_service')
|
15
|
+
require_relative 'shared/pure_service'
|
16
|
+
require_relative 'shared/interactor_service'
|
17
|
+
require_relative 'shared/active_interaction_service'
|
18
|
+
require_relative 'shared/trailblazer_service'
|
19
|
+
require_relative 'shared/callable_step'
|
20
|
+
|
21
|
+
require_relative 'step/yaso'
|
22
|
+
RUBY_VERSION.include?('2.5') || require_relative('step/decouplio')
|
23
|
+
require_relative 'step/pure'
|
24
|
+
require_relative 'step/interactor'
|
25
|
+
require_relative 'step/active_interaction'
|
26
|
+
require_relative 'step/trailblazer'
|
27
|
+
require_relative 'step/benchmark'
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ActiveInteractionStepsService < ActiveInteractionService
|
4
|
+
hash :ctx, default: {}
|
5
|
+
|
6
|
+
def execute
|
7
|
+
one
|
8
|
+
two
|
9
|
+
three
|
10
|
+
four
|
11
|
+
five
|
12
|
+
six
|
13
|
+
seven
|
14
|
+
eight
|
15
|
+
nine
|
16
|
+
ten
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def one
|
22
|
+
ctx[:one] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
def two
|
26
|
+
ctx[:two] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
def three
|
30
|
+
ctx[:three] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def four
|
34
|
+
ctx[:four] = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def five
|
38
|
+
ctx[:five] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
def six
|
42
|
+
ctx[:six] = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def seven
|
46
|
+
ctx[:seven] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def eight
|
50
|
+
ctx[:eight] = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def nine
|
54
|
+
ctx[:nine] = true
|
55
|
+
end
|
56
|
+
|
57
|
+
def ten
|
58
|
+
ctx[:ten] = true
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class ActiveInteractionCallableStep < ActiveInteractionService
|
63
|
+
hash :ctx
|
64
|
+
symbol :key
|
65
|
+
boolean :value
|
66
|
+
|
67
|
+
def execute
|
68
|
+
ctx[key] = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class ActiveInteractionCallablesService < ActiveInteractionService
|
73
|
+
hash :ctx, default: {}
|
74
|
+
|
75
|
+
# rubocop:disable Metrics/AbcSize
|
76
|
+
def execute
|
77
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :one, value: true)
|
78
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :two, value: true)
|
79
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :three, value: true)
|
80
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :four, value: true)
|
81
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :five, value: true)
|
82
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :six, value: true)
|
83
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :seven, value: true)
|
84
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :eight, value: true)
|
85
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :nine, value: true)
|
86
|
+
compose(ActiveInteractionCallableStep, ctx: ctx, key: :ten, value: true)
|
87
|
+
end
|
88
|
+
# rubocop:enable Metrics/AbcSize
|
89
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
puts 'Step Benchmark'
|
4
|
+
|
5
|
+
puts 'Services with 10 simple steps'
|
6
|
+
Benchmark.ips do |x|
|
7
|
+
x.config(stats: :bootstrap, confidence: 95)
|
8
|
+
|
9
|
+
x.report('Pure Service') { PureStepsService.call }
|
10
|
+
x.report('Decouplio Service') { DecouplioStepsService.call } unless RUBY_VERSION.include?('2.5')
|
11
|
+
x.report('Yaso Service') { YasoStepsService.call }
|
12
|
+
x.report('Interactor Service') { InteractorStepsService.call }
|
13
|
+
x.report('ActiveInteraction Service') { ActiveInteractionStepsService.run }
|
14
|
+
x.report('Trailblazer Service') { TrailblazerStepsService.call }
|
15
|
+
|
16
|
+
x.compare!
|
17
|
+
end
|
18
|
+
|
19
|
+
puts 'Services with 10 callable steps'
|
20
|
+
Benchmark.ips do |x|
|
21
|
+
x.config(stats: :bootstrap, confidence: 95)
|
22
|
+
|
23
|
+
x.report('Pure Service') { PureCallablesService.call }
|
24
|
+
x.report('Decouplio Service') { DecouplioCallablesService.call } unless RUBY_VERSION.include?('2.5')
|
25
|
+
x.report('Yaso Service') { YasoCallablesService.call }
|
26
|
+
x.report('Interactor Service') { InteractorCallablesService.call }
|
27
|
+
x.report('ActiveInteraction Service') { ActiveInteractionCallablesService.run }
|
28
|
+
x.report('Trailblazer Service') { TrailblazerCallablesService.call }
|
29
|
+
|
30
|
+
x.compare!
|
31
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DecouplioStepsService < DecouplioService
|
4
|
+
logic do
|
5
|
+
step :one
|
6
|
+
step :two
|
7
|
+
step :three
|
8
|
+
step :four
|
9
|
+
step :five
|
10
|
+
step :six
|
11
|
+
step :seven
|
12
|
+
step :eight
|
13
|
+
step :nine
|
14
|
+
step :ten
|
15
|
+
end
|
16
|
+
|
17
|
+
def one(**)
|
18
|
+
ctx[:one] = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def two(**)
|
22
|
+
ctx[:two] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
def three(**)
|
26
|
+
ctx[:three] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
def four(**)
|
30
|
+
ctx[:four] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def five(**)
|
34
|
+
ctx[:five] = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def six(**)
|
38
|
+
ctx[:six] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
def seven(**)
|
42
|
+
ctx[:seven] = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def eight(**)
|
46
|
+
ctx[:eight] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def nine(**)
|
50
|
+
ctx[:nine] = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def ten(**)
|
54
|
+
ctx[:ten] = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class DecouplioCallableStep
|
59
|
+
def self.call(ctx:, key:, value:, **)
|
60
|
+
ctx[key] = value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class DecouplioCallablesService < DecouplioService
|
65
|
+
logic do
|
66
|
+
step DecouplioCallableStep, key: :one, value: true
|
67
|
+
step DecouplioCallableStep, key: :two, value: true
|
68
|
+
step DecouplioCallableStep, key: :three, value: true
|
69
|
+
step DecouplioCallableStep, key: :four, value: true
|
70
|
+
step DecouplioCallableStep, key: :five, value: true
|
71
|
+
step DecouplioCallableStep, key: :six, value: true
|
72
|
+
step DecouplioCallableStep, key: :seven, value: true
|
73
|
+
step DecouplioCallableStep, key: :eight, value: true
|
74
|
+
step DecouplioCallableStep, key: :nine, value: true
|
75
|
+
step DecouplioCallableStep, key: :ten, value: true
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class InteractorStepsService < InteractorService
|
4
|
+
def call
|
5
|
+
one
|
6
|
+
two
|
7
|
+
three
|
8
|
+
four
|
9
|
+
five
|
10
|
+
six
|
11
|
+
seven
|
12
|
+
eight
|
13
|
+
nine
|
14
|
+
ten
|
15
|
+
end
|
16
|
+
|
17
|
+
def one
|
18
|
+
context.one = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def two
|
22
|
+
context.two = true
|
23
|
+
end
|
24
|
+
|
25
|
+
def three
|
26
|
+
context.three = true
|
27
|
+
end
|
28
|
+
|
29
|
+
def four
|
30
|
+
context.four = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def five
|
34
|
+
context.five = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def six
|
38
|
+
context.six = true
|
39
|
+
end
|
40
|
+
|
41
|
+
def seven
|
42
|
+
context.seven = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def eight
|
46
|
+
context.eight = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def nine
|
50
|
+
context.nine = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def ten
|
54
|
+
context.ten = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class InteractorCallableStep < InteractorService
|
59
|
+
def call
|
60
|
+
context.one = true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class InteractorCallablesService < InteractorOrganizer
|
65
|
+
organize InteractorCallableStep,
|
66
|
+
InteractorCallableStep,
|
67
|
+
InteractorCallableStep,
|
68
|
+
InteractorCallableStep,
|
69
|
+
InteractorCallableStep,
|
70
|
+
InteractorCallableStep,
|
71
|
+
InteractorCallableStep,
|
72
|
+
InteractorCallableStep,
|
73
|
+
InteractorCallableStep,
|
74
|
+
InteractorCallableStep
|
75
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class PureStepsService < PureService
|
4
|
+
def call
|
5
|
+
one
|
6
|
+
two
|
7
|
+
three
|
8
|
+
four
|
9
|
+
five
|
10
|
+
six
|
11
|
+
seven
|
12
|
+
eight
|
13
|
+
nine
|
14
|
+
ten
|
15
|
+
end
|
16
|
+
|
17
|
+
def one
|
18
|
+
ctx[:one] = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def two
|
22
|
+
ctx[:two] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
def three
|
26
|
+
ctx[:three] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
def four
|
30
|
+
ctx[:four] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def five
|
34
|
+
ctx[:five] = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def six
|
38
|
+
ctx[:six] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
def seven
|
42
|
+
ctx[:seven] = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def eight
|
46
|
+
ctx[:eight] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def nine
|
50
|
+
ctx[:nine] = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def ten
|
54
|
+
ctx[:ten] = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class PureCallablesService < PureService
|
59
|
+
# rubocop:disable Metrics/AbcSize
|
60
|
+
def call
|
61
|
+
CallableStep.call(ctx, key: :one, value: true)
|
62
|
+
CallableStep.call(ctx, key: :two, value: true)
|
63
|
+
CallableStep.call(ctx, key: :three, value: true)
|
64
|
+
CallableStep.call(ctx, key: :four, value: true)
|
65
|
+
CallableStep.call(ctx, key: :five, value: true)
|
66
|
+
CallableStep.call(ctx, key: :six, value: true)
|
67
|
+
CallableStep.call(ctx, key: :seven, value: true)
|
68
|
+
CallableStep.call(ctx, key: :eight, value: true)
|
69
|
+
CallableStep.call(ctx, key: :nine, value: true)
|
70
|
+
CallableStep.call(ctx, key: :ten, value: true)
|
71
|
+
end
|
72
|
+
# rubocop:enable Metrics/AbcSize
|
73
|
+
end
|