dry-effects 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/dry/effects/all.rb +1 -5
  4. data/lib/dry/effects/constructors.rb +29 -3
  5. data/lib/dry/effects/container.rb +1 -3
  6. data/lib/dry/effects/effect.rb +0 -2
  7. data/lib/dry/effects/effects/async.rb +0 -2
  8. data/lib/dry/effects/effects/cache.rb +0 -2
  9. data/lib/dry/effects/effects/cmp.rb +0 -2
  10. data/lib/dry/effects/effects/current_time.rb +0 -11
  11. data/lib/dry/effects/effects/defer.rb +0 -2
  12. data/lib/dry/effects/effects/env.rb +0 -2
  13. data/lib/dry/effects/effects/fork.rb +0 -2
  14. data/lib/dry/effects/effects/implicit.rb +0 -2
  15. data/lib/dry/effects/effects/interrupt.rb +0 -2
  16. data/lib/dry/effects/effects/lock.rb +0 -2
  17. data/lib/dry/effects/effects/parallel.rb +0 -2
  18. data/lib/dry/effects/effects/random.rb +0 -2
  19. data/lib/dry/effects/effects/reader.rb +0 -2
  20. data/lib/dry/effects/effects/resolve.rb +1 -6
  21. data/lib/dry/effects/effects/retry.rb +0 -7
  22. data/lib/dry/effects/effects/state.rb +0 -11
  23. data/lib/dry/effects/effects/timeout.rb +0 -2
  24. data/lib/dry/effects/effects/timestamp.rb +0 -2
  25. data/lib/dry/effects/extensions/auto_inject.rb +1 -2
  26. data/lib/dry/effects/frame.rb +0 -5
  27. data/lib/dry/effects/halt.rb +0 -1
  28. data/lib/dry/effects/inflector.rb +0 -2
  29. data/lib/dry/effects/initializer.rb +0 -2
  30. data/lib/dry/effects/instructions/execute.rb +0 -6
  31. data/lib/dry/effects/instructions/raise.rb +0 -6
  32. data/lib/dry/effects/instructions.rb +15 -0
  33. data/lib/dry/effects/provider/class_interface.rb +1 -3
  34. data/lib/dry/effects/provider.rb +0 -3
  35. data/lib/dry/effects/providers/async.rb +0 -3
  36. data/lib/dry/effects/providers/cache.rb +0 -3
  37. data/lib/dry/effects/providers/cmp.rb +0 -2
  38. data/lib/dry/effects/providers/current_time/time_generators.rb +1 -3
  39. data/lib/dry/effects/providers/current_time.rb +1 -3
  40. data/lib/dry/effects/providers/defer.rb +0 -2
  41. data/lib/dry/effects/providers/env.rb +0 -3
  42. data/lib/dry/effects/providers/fork.rb +0 -3
  43. data/lib/dry/effects/providers/implicit.rb +0 -2
  44. data/lib/dry/effects/providers/interrupt.rb +0 -4
  45. data/lib/dry/effects/providers/lock.rb +0 -3
  46. data/lib/dry/effects/providers/parallel.rb +0 -2
  47. data/lib/dry/effects/providers/random.rb +0 -2
  48. data/lib/dry/effects/providers/reader.rb +0 -2
  49. data/lib/dry/effects/providers/resolve.rb +0 -3
  50. data/lib/dry/effects/providers/retry.rb +0 -3
  51. data/lib/dry/effects/providers/state.rb +0 -3
  52. data/lib/dry/effects/providers/timeout.rb +0 -2
  53. data/lib/dry/effects/providers/timestamp.rb +2 -5
  54. data/lib/dry/effects/stack.rb +2 -6
  55. data/lib/dry/effects/version.rb +1 -1
  56. data/lib/dry/effects.rb +29 -4
  57. data/lib/dry-effects.rb +1 -0
  58. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0239ad7c00317ef55c59d15f20b9445a23e4209ee381e6eb0e46300cca5615a4'
4
- data.tar.gz: 25c49fe75fe6ada449943aa1642763acab11e20d91d66cd3ed0e5353ecf747b6
3
+ metadata.gz: abc06cbff85f6545a5b05ebeb778737a316fadf9222c9e98c015e05a91e16cdf
4
+ data.tar.gz: 7023b7bc8b4807c957f561706f9cd8215cc181cf37de06ae218ec48fac48f9da
5
5
  SHA512:
6
- metadata.gz: 311d562013b53ed8e3744b2dd433ab5200313e17021ec8b9e3219d48d1ff31ddd824c537b8282be3647e90dd4045369229814f58782c13bd47be7374f9b48036
7
- data.tar.gz: 7eac1b68843190d616057fdd61212ae46e70b3f88b21318daad6e1a5b9d6ea7d15ddbf32e0171095e16a8929d7d45d3661a4eb264629043cb3ae1a794ffc5da4
6
+ metadata.gz: f240e7f7cf989b27dc384bf2ec84f6a2b021c8f9b76694167a493140d4beb0dfed96fcad700681154362b2cb8569051baf07e849993d8744b91ec24443ba32af
7
+ data.tar.gz: 60185bafd1a5f68a771c9bcd971412ca09e4cf5b81da8ea659706b713b1a55a67989ae4f59d8ae1c57adbf006731416a3f9e4c78254637a73e7a24ccd03c7203
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 0.3.1 2022-10-17
4
+
5
+
6
+ ### Changed
7
+
8
+ - Add missing zeitwerk loader (@flash-gordon)
9
+
10
+ [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-effects/compare/v0.3.0...v0.3.1)
11
+
3
12
  ## 0.3.0 2022-10-15
4
13
 
5
14
 
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "concurrent/map"
4
- require "dry/effects/inflector"
5
- require "dry/effects/handler"
6
-
7
3
  module Dry
8
4
  module Effects
9
5
  default = %i[
@@ -40,7 +36,7 @@ module Dry
40
36
  Providers.const_get(Inflector.camelize(key))
41
37
  end
42
38
 
43
- Handler.singleton_class.send(:define_method, class_name) do |*args, **kwargs|
39
+ Handler.singleton_class.define_method(class_name) do |*args, **kwargs|
44
40
  ::Dry::Effects.providers[key].mixin(*args, **kwargs)
45
41
  end
46
42
  end
@@ -3,9 +3,35 @@
3
3
  module Dry
4
4
  module Effects
5
5
  module Constructors
6
- def self.register(name, &block)
7
- define_method(name, &block)
8
- module_function name
6
+ extend self
7
+
8
+ # @api public
9
+ def CurrentTime(**kwargs)
10
+ if kwargs.empty?
11
+ Effects::CurrentTime::CurrentTime
12
+ else
13
+ Effects::CurrentTime::CurrentTime.(**kwargs)
14
+ end
15
+ end
16
+
17
+ # @api public
18
+ def Resolve(identifier)
19
+ Effects::Resolve::Resolve.(identifier)
20
+ end
21
+
22
+ # @api public
23
+ def Retry(scope)
24
+ Effects::Retry::Retry.new(type: :retry, scope: scope)
25
+ end
26
+
27
+ # @api public
28
+ def Read(scope)
29
+ Effects::State::State.new(type: :state, name: :read, scope: scope)
30
+ end
31
+
32
+ # @api public
33
+ def Write(scope, value)
34
+ Effects::State::State.new(type: :state, name: :write, scope: scope, payload: [value])
9
35
  end
10
36
  end
11
37
  end
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/container"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  class Container
8
- include Dry::Container::Mixin
6
+ include ::Dry::Container::Mixin
9
7
  end
10
8
  end
11
9
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/initializer"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  class Effect
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,22 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
- require "dry/effects/constructors"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Effects
9
6
  class CurrentTime < ::Module
10
7
  CurrentTime = Effect.new(type: :current_time)
11
8
 
12
- Constructors.register(:CurrentTime) do |**kwargs|
13
- if kwargs.empty?
14
- CurrentTime
15
- else
16
- CurrentTime.(**kwargs)
17
- end
18
- end
19
-
20
9
  def initialize(**options)
21
10
  super()
22
11
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effects/state"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,20 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
- require "dry/effects/constructors"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Effects
9
6
  class Resolve < ::Module
10
- DependencyNameInvalid = Class.new(StandardError)
7
+ DependencyNameInvalid = ::Class.new(StandardError)
11
8
 
12
9
  VALID_NAME = /([a-z_][a-zA-Z_0-9]*)$/.freeze
13
10
 
14
11
  Resolve = Effect.new(type: :resolve)
15
12
 
16
- Constructors.register(:Resolve) { Resolve.(_1) }
17
-
18
13
  def initialize(*keys, **aliases)
19
14
  super()
20
15
 
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
- require "dry/effects/constructors"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Effects
@@ -13,10 +10,6 @@ module Dry
13
10
  option :scope
14
11
  end
15
12
 
16
- Constructors.register(:Retry) do |scope|
17
- Retry.new(type: :retry, scope: scope)
18
- end
19
-
20
13
  def initialize
21
14
  super
22
15
 
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
- require "dry/effects/constructors"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Effects
@@ -13,14 +10,6 @@ module Dry
13
10
  option :scope
14
11
  end
15
12
 
16
- Constructors.register(:Read) do |scope|
17
- State.new(type: :state, name: :read, scope: scope)
18
- end
19
-
20
- Constructors.register(:Write) do |scope, value|
21
- State.new(type: :state, name: :write, scope: scope, payload: [value])
22
- end
23
-
24
13
  def initialize(scope, default: Undefined, writer: true, as: scope)
25
14
  super()
26
15
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/effect"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Effects
@@ -2,12 +2,11 @@
2
2
 
3
3
  require "concurrent/map"
4
4
  require "dry/auto_inject/strategies/constructor"
5
- require "dry/effects/effects/resolve"
6
5
 
7
6
  module Dry
8
7
  module Effects
9
8
  class DryAutoEffectsStrategies
10
- extend Dry::Container::Mixin
9
+ extend ::Dry::Container::Mixin
11
10
 
12
11
  class Base < AutoInject::Strategies::Constructor
13
12
  private
@@ -1,11 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "fiber"
4
- require "dry/effects/initializer"
5
- require "dry/effects/effect"
6
- require "dry/effects/errors"
7
- require "dry/effects/stack"
8
- require "dry/effects/instructions/raise"
9
4
 
10
5
  module Dry
11
6
  module Effects
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/map"
4
- require "dry/effects/inflector"
5
4
 
6
5
  module Dry
7
6
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/inflector"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  Inflector = ::Dry::Inflector.new
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/initializer"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Initializer
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/instruction"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Instructions
@@ -17,10 +15,6 @@ module Dry
17
15
  block.call
18
16
  end
19
17
  end
20
-
21
- def self.Execute(&block)
22
- Execute.new(block)
23
- end
24
18
  end
25
19
  end
26
20
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/instruction"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Instructions
@@ -17,10 +15,6 @@ module Dry
17
15
  raise error
18
16
  end
19
17
  end
20
-
21
- def self.Raise(error)
22
- Raise.new(error)
23
- end
24
18
  end
25
19
  end
26
20
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dry
4
+ module Effects
5
+ module Instructions
6
+ def self.Raise(error)
7
+ Raise.new(error)
8
+ end
9
+
10
+ def self.Execute(&block)
11
+ Execute.new(block)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/frame"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  class Provider
@@ -14,7 +12,7 @@ module Dry
14
12
  @effects = ::Hash.new do |es, type|
15
13
  @mutex.synchronize do
16
14
  es.fetch(type) do
17
- es[type] = Class.new(Provider).tap do |provider|
15
+ es[type] = ::Class.new(Provider).tap do |provider|
18
16
  provider.type type
19
17
  end
20
18
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/initializer"
4
- require "dry/effects/provider/class_interface"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  # Base class for effect providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/frame"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/instructions/execute"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
@@ -1,12 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
8
6
  class CurrentTime < Provider[:current_time]
9
- module TimeGenetators
7
+ module TimeGenerators
10
8
  FixedTimeGenerator = lambda do
11
9
  time = ::Time.now
12
10
  lambda do |refresh: false, **|
@@ -1,15 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "time"
4
- require "dry/effects/provider"
5
- require "dry/effects/providers/current_time/time_generators"
6
4
 
7
5
  module Dry
8
6
  module Effects
9
7
  module Providers
10
8
  class CurrentTime < Provider[:current_time]
11
9
  include ::Dry::Equalizer(:fixed, :round, inspect: false)
12
- include TimeGenetators
10
+ include TimeGenerators
13
11
 
14
12
  Locate = Effect.new(type: :current_time, name: :locate)
15
13
 
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/promise"
4
- require "dry/effects/provider"
5
- require "dry/effects/frame"
6
4
 
7
5
  module Dry
8
6
  module Effects
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/instructions/raise"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/frame"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/instructions/raise"
5
- require "dry/effects/halt"
6
-
7
3
  module Dry
8
4
  module Effects
9
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/initializer"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/promise"
4
- require "dry/effects/provider"
5
- require "dry/effects/frame"
6
4
 
7
5
  module Dry
8
6
  module Effects
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/instructions/raise"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/halt"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/providers/reader"
4
- require "dry/effects/instructions/raise"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
-
5
3
  module Dry
6
4
  module Effects
7
5
  module Providers
@@ -1,14 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/provider"
4
- require "dry/effects/providers/current_time"
5
-
6
3
  module Dry
7
4
  module Effects
8
5
  module Providers
9
6
  class Timestamp < Provider[:timestamp]
10
- include Dry::Equalizer(:round)
11
- include CurrentTime::TimeGenetators
7
+ include ::Dry::Equalizer(:round)
8
+ include CurrentTime::TimeGenerators
12
9
 
13
10
  Locate = Effect.new(type: :timestamp, name: :locate)
14
11
 
@@ -1,15 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/effects/initializer"
4
- require "dry/effects/effect"
5
- require "dry/effects/instructions/raise"
6
-
7
3
  module Dry
8
4
  module Effects
9
5
  class Stack
10
6
  extend Initializer
11
- include Enumerable
12
- include Dry::Equalizer(:providers)
7
+ include ::Enumerable
8
+ include ::Dry::Equalizer(:providers)
13
9
 
14
10
  param :providers, default: -> { [] }
15
11
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Effects
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
data/lib/dry/effects.rb CHANGED
@@ -1,21 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "zeitwerk"
4
+ require "concurrent/map"
5
+
3
6
  require "dry/core"
4
- require "dry/effects/version"
7
+ require "dry/container"
8
+ require "dry/inflector"
9
+ require "dry/initializer"
10
+
5
11
  require "dry/effects/container"
12
+ require "dry/effects/inflector"
13
+ require "dry/effects/initializer"
14
+ require "dry/effects/extensions"
6
15
  require "dry/effects/errors"
7
- require "dry/effects/instructions/raise"
16
+ require "dry/effects/version"
8
17
 
9
18
  module Dry
10
19
  module Effects
11
20
  include Core::Constants
12
21
 
13
- class Error < StandardError; end
22
+ class Error < ::StandardError; end
14
23
 
15
24
  @effects = Container.new
16
25
  @providers = Container.new
17
26
 
18
27
  class << self
28
+ # @api private
29
+ def loader
30
+ @loader ||= ::Zeitwerk::Loader.new.tap do |loader|
31
+ root = ::File.expand_path("..", __dir__)
32
+ loader.tag = "dry-effects"
33
+ loader.inflector = ::Zeitwerk::GemInflector.new("#{root}/dry-effects.rb")
34
+ loader.push_dir(root)
35
+ loader.ignore(
36
+ "#{root}/dry-effects.rb",
37
+ "#{root}/dry/effects/{all,error,extensions,inflector,initializer,version}.rb",
38
+ "#{root}/dry/effects/extensions/**/*.rb",
39
+ )
40
+ end
41
+ end
42
+
19
43
  attr_reader :effects, :providers
20
44
 
21
45
  # Handle an effect.
@@ -66,8 +90,9 @@ module Dry
66
90
  Handler.new(...)
67
91
  end
68
92
  end
93
+
94
+ loader.setup
69
95
  end
70
96
  end
71
97
 
72
98
  require "dry/effects/all"
73
- require "dry/effects/extensions"
@@ -0,0 +1 @@
1
+ require "dry/effects"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-effects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shilnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-15 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -151,6 +151,7 @@ files:
151
151
  - LICENSE
152
152
  - README.md
153
153
  - dry-effects.gemspec
154
+ - lib/dry-effects.rb
154
155
  - lib/dry/effects.rb
155
156
  - lib/dry/effects/all.rb
156
157
  - lib/dry/effects/constructors.rb
@@ -186,6 +187,7 @@ files:
186
187
  - lib/dry/effects/inflector.rb
187
188
  - lib/dry/effects/initializer.rb
188
189
  - lib/dry/effects/instruction.rb
190
+ - lib/dry/effects/instructions.rb
189
191
  - lib/dry/effects/instructions/execute.rb
190
192
  - lib/dry/effects/instructions/raise.rb
191
193
  - lib/dry/effects/provider.rb