dry-effects 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -9
- data/dry-effects.gemspec +27 -35
- data/lib/dry/effects/extensions.rb +8 -0
- data/lib/dry/effects/extensions/active_support/tagged_logging.rb +13 -0
- data/lib/dry/effects/version.rb +1 -1
- metadata +18 -47
- data/.codeclimate.yml +0 -12
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
- data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
- data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
- data/.github/workflows/ci.yml +0 -52
- data/.github/workflows/docsite.yml +0 -34
- data/.github/workflows/sync_configs.yml +0 -56
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.rubocop.yml +0 -101
- data/CODE_OF_CONDUCT.md +0 -13
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -20
- data/Gemfile.devtools +0 -14
- data/Rakefile +0 -8
- data/docsite/source/effects.html.md +0 -29
- data/docsite/source/effects/cache.html.md +0 -84
- data/docsite/source/effects/current_time.html.md +0 -186
- data/docsite/source/effects/defer.html.md +0 -130
- data/docsite/source/effects/env.html.md +0 -144
- data/docsite/source/effects/interrupt.html.md +0 -109
- data/docsite/source/effects/parallel.html.md +0 -25
- data/docsite/source/effects/reader.html.md +0 -126
- data/docsite/source/effects/resolve.html.md +0 -188
- data/docsite/source/effects/state.html.md +0 -178
- data/docsite/source/effects/timeout.html.md +0 -44
- data/docsite/source/index.html.md +0 -212
- data/examples/cmp.rb +0 -51
- data/examples/state.rb +0 -29
- data/project.yml +0 -2
data/examples/cmp.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Operation
|
4
|
-
include Dry::Effects.State(:counter)
|
5
|
-
include Dry::Effects.Cmp(:feature_enabled)
|
6
|
-
|
7
|
-
def call
|
8
|
-
if feature_enabled?
|
9
|
-
self.counter += 10
|
10
|
-
:with_feature
|
11
|
-
else
|
12
|
-
self.counter += 1
|
13
|
-
:without_feature
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
module Handler
|
19
|
-
include Dry::Effects::Handler.State(:counter, as: :with_counter)
|
20
|
-
include Dry::Effects::Handler.Cmp(:feature_enabled, as: :test_feature)
|
21
|
-
end
|
22
|
-
|
23
|
-
class CmpState
|
24
|
-
include Handler
|
25
|
-
|
26
|
-
def initialize
|
27
|
-
@operation = Operation.new
|
28
|
-
end
|
29
|
-
|
30
|
-
def call
|
31
|
-
test_feature { with_counter(0) { @operation.call } }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class StateCmp
|
36
|
-
include Handler
|
37
|
-
|
38
|
-
def initialize
|
39
|
-
@operation = Operation.new
|
40
|
-
end
|
41
|
-
|
42
|
-
def call
|
43
|
-
with_counter(0) { test_feature { @operation.call } }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
cmp_then_state = CmpState.new
|
48
|
-
state_then_cmp = State.Cmp.new
|
49
|
-
|
50
|
-
cmp_then_state.() # => [[1, :without_feature], [10, :with_feature]]
|
51
|
-
state_then_cmp.() # => [11, [:without_feature, :with_feature]]
|
data/examples/state.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Operation
|
4
|
-
include Dry::Effects.State(:counter)
|
5
|
-
|
6
|
-
def call
|
7
|
-
3.times do
|
8
|
-
self.counter += 1
|
9
|
-
end
|
10
|
-
|
11
|
-
:done
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class Wrapper
|
16
|
-
include Dry::Effects::Handler.State(:counter)
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@operation = Operation.new
|
20
|
-
end
|
21
|
-
|
22
|
-
def call
|
23
|
-
with_counter(0) { @operation.call }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
__END__
|
28
|
-
|
29
|
-
Wrapper.new.call # => [3, :done]
|
data/project.yml
DELETED