dry-effects 0.2.0 → 0.3.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: 80f0e1405c5ca987eb7f24a1ae3c71371f83595380ad49d04a61980767dbe06e
4
- data.tar.gz: '028feb1018847ee3713b8a7cbad4572328d7b30f251889e5f58112fa7b25fa3e'
3
+ metadata.gz: '0239ad7c00317ef55c59d15f20b9445a23e4209ee381e6eb0e46300cca5615a4'
4
+ data.tar.gz: 25c49fe75fe6ada449943aa1642763acab11e20d91d66cd3ed0e5353ecf747b6
5
5
  SHA512:
6
- metadata.gz: 9c37d67a9030142e310e0df86d06fbdd63d21a3f3b52ea4f9f7792f9561e9ba48a58d50caad469bcfa4c30ef500b1d5772ebe4153001b65efd2390acb080a3ae
7
- data.tar.gz: e4dc39c74bbb28a2ab0e79410752f0ceddff4bcd8d351b457c79dd608125c10709612ffb6c21c4b4b55714ad8a151a3c9d1ba93297931126f7c59f3e04d79d65
6
+ metadata.gz: 311d562013b53ed8e3744b2dd433ab5200313e17021ec8b9e3219d48d1ff31ddd824c537b8282be3647e90dd4045369229814f58782c13bd47be7374f9b48036
7
+ data.tar.gz: 7eac1b68843190d616057fdd61212ae46e70b3f88b21318daad6e1a5b9d6ea7d15ddbf32e0171095e16a8929d7d45d3661a4eb264629043cb3ae1a794ffc5da4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 0.3.0 2022-10-15
4
+
5
+
6
+ ### Changed
7
+
8
+ - Use zeitwerk for auto-loading (@flash-gordon)
9
+ - Remove dependency on dry-configurable (@flash-gordon)
10
+
11
+ [Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-effects/compare/v0.2.0...v0.3.0)
12
+
3
13
  ## 0.2.0 2021-09-12
4
14
 
5
15
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2022 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -8,10 +8,10 @@
8
8
  # dry-effects [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
9
9
 
10
10
  [![Gem Version](https://badge.fury.io/rb/dry-effects.svg)][gem]
11
- [![CI Status](https://github.com/dry-rb/dry-effects/workflows/CI/badge.svg)][actions]
11
+ [![CI Status](https://github.com/dry-rb/dry-effects/workflows/ci/badge.svg)][actions]
12
12
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/158a8a584a3845eba4a67a71ad540210)][codacy]
13
13
  [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/158a8a584a3845eba4a67a71ad540210)][codacy]
14
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-effects.svg?branch=master)][inchpages]
14
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-effects.svg?branch=main)][inchpages]
15
15
 
16
16
  ## Links
17
17
 
@@ -22,8 +22,8 @@
22
22
 
23
23
  This library officially supports the following Ruby versions:
24
24
 
25
- * MRI `>= 2.6.0`
26
- * ~~jruby~~ `>= 9.3` (we are waiting for [2.6 support](https://github.com/jruby/jruby/issues/6161))
25
+ * MRI `>= 2.7.0`
26
+ * jruby `>= 9.3` (postponed until 2.7 is supported)
27
27
 
28
28
  ## License
29
29
 
data/dry-effects.gemspec CHANGED
@@ -22,16 +22,16 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
- spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-effects/blob/master/CHANGELOG.md"
25
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-effects/blob/main/CHANGELOG.md"
26
26
  spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-effects"
27
27
  spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-effects/issues"
28
28
 
29
- spec.required_ruby_version = ">= 2.6.0"
29
+ spec.required_ruby_version = ">= 2.7.0"
30
30
 
31
31
  # to update dependencies edit project.yml
32
32
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
33
33
  spec.add_runtime_dependency "dry-container", "~> 0.7", ">= 0.7.2"
34
- spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
34
+ spec.add_runtime_dependency "dry-core", "~> 0.9", ">= 0.9"
35
35
  spec.add_runtime_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
36
36
  spec.add_runtime_dependency "dry-initializer", "~> 3.0"
37
37
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/equalizer"
4
3
  require "dry/effects/initializer"
5
4
 
6
5
  module Dry
@@ -15,7 +15,7 @@ module Dry
15
15
 
16
16
  module_eval do
17
17
  define_method(:async) { |&block| ::Dry::Effects.yield(Async.(block)) }
18
- define_method(:await) { |task| ::Dry::Effects.yield(Await.(task)) }
18
+ define_method(:await) { ::Dry::Effects.yield(Await.(_1)) }
19
19
  end
20
20
  end
21
21
  end
@@ -13,7 +13,7 @@ module Dry
13
13
  super
14
14
 
15
15
  define_method(:par) { |&block| ::Dry::Effects.yield(Par).(&block) }
16
- define_method(:join) { |xs| ::Dry::Effects.yield(Join.payload(xs)) }
16
+ define_method(:join) { ::Dry::Effects.yield(Join.payload(_1)) }
17
17
  end
18
18
  end
19
19
  end
@@ -13,12 +13,12 @@ module Dry
13
13
 
14
14
  Resolve = Effect.new(type: :resolve)
15
15
 
16
- Constructors.register(:Resolve) { |key| Resolve.(key) }
16
+ Constructors.register(:Resolve) { Resolve.(_1) }
17
17
 
18
18
  def initialize(*keys, **aliases)
19
19
  super()
20
20
 
21
- keys_aliased = keys.map { |k| name_for(k) }.zip(keys)
21
+ keys_aliased = keys.map { name_for(_1) }.zip(keys)
22
22
  module_eval do
23
23
  (keys_aliased + aliases.to_a).each do |name, key|
24
24
  define_method(name) { |&block| ::Dry::Effects.yield(Resolve.(key), &block) }
@@ -20,7 +20,7 @@ module Dry
20
20
  super(
21
21
  Undefined.default(message) {
22
22
  "Effect #{effect.inspect} not handled. "\
23
- "Effects must be wrapped with corresponding handlers"
23
+ "Effects must be wrapped with corresponding handlers"
24
24
  }
25
25
  )
26
26
  end
@@ -24,7 +24,7 @@ module Dry
24
24
  class Static < Base
25
25
  private
26
26
 
27
- def define_readers(dynamic = false) # rubocop:disable Style/OptionalBooleanParameter
27
+ def define_readers(dynamic: false)
28
28
  map = dependency_map.to_h
29
29
  cache = ::Concurrent::Map.new
30
30
  instance_mod.class_exec do
@@ -49,7 +49,7 @@ module Dry
49
49
  class Dynamic < Static
50
50
  private
51
51
 
52
- def define_readers(dynamic = true) # rubocop:disable Style/OptionalBooleanParameter
52
+ def define_readers(dynamic: true)
53
53
  super
54
54
  end
55
55
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/system/container"
3
+ require "dry/system"
4
4
 
5
5
  Dry::Effects.load_extensions(:auto_inject)
6
6
 
@@ -10,7 +10,7 @@ module Dry
10
10
  class AutoRegistrar < ::Dry::System::AutoRegistrar
11
11
  # Always memoize and freeze registered components
12
12
  def call(component_dir)
13
- components(component_dir).each do |component|
13
+ component_dir.each_component do |component|
14
14
  next unless register_component?(component)
15
15
 
16
16
  container.register(component.key, memoize: true) { component.instance.freeze }
@@ -19,7 +19,7 @@ module Dry
19
19
  end
20
20
 
21
21
  class Container < ::Dry::System::Container
22
- config.auto_registrar = AutoRegistrar
22
+ setting :auto_registrar, default: AutoRegistrar
23
23
 
24
24
  def self.injector(effects: true, **kwargs)
25
25
  if effects
@@ -35,7 +35,7 @@ module Dry
35
35
  super
36
36
 
37
37
  # Force all components to load
38
- each_key { |key| resolve(key) }
38
+ each_key { resolve(_1) }
39
39
  self
40
40
  end
41
41
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/extensions"
4
-
5
3
  Dry::Effects.extend(Dry::Core::Extensions)
6
4
 
7
5
  Dry::Effects.register_extension(:auto_inject) do
@@ -62,16 +62,9 @@ module Dry
62
62
 
63
63
  private
64
64
 
65
- if RUBY_VERSION >= "2.7"
66
- # @api private
67
- def raise_in_fiber(fiber, error)
68
- fiber.raise(error)
69
- end
70
- else
71
- # @api private
72
- def raise_in_fiber(fiber, error)
73
- fiber.resume(Instructions.Raise(error))
74
- end
65
+ # @api private
66
+ def raise_in_fiber(fiber, error)
67
+ fiber.raise(error)
75
68
  end
76
69
  end
77
70
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/map"
4
- require "dry/core/class_attributes"
5
4
  require "dry/effects/inflector"
6
5
 
7
6
  module Dry
@@ -12,16 +12,8 @@ module Dry
12
12
  @frame = Frame.new(provider)
13
13
  end
14
14
 
15
- if RUBY_VERSION >= "2.7"
16
- class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
17
- def call(...)
18
- frame.(...)
19
- end
20
- RUBY
21
- else
22
- def call(*args, &block)
23
- frame.(*args, &block)
24
- end
15
+ def call(...)
16
+ frame.(...)
25
17
  end
26
18
 
27
19
  def to_s
@@ -29,7 +29,7 @@ module Dry
29
29
  def params_arity
30
30
  @params_arity ||= dry_initializer
31
31
  .definitions
32
- .reject { |_, d| d.option }
32
+ .reject { _2.option }
33
33
  .size
34
34
  end
35
35
 
@@ -44,7 +44,7 @@ module Dry
44
44
  def __define_with__
45
45
  seq_names = dry_initializer
46
46
  .definitions
47
- .reject { |_, d| d.option }
47
+ .reject { _2.option }
48
48
  .keys
49
49
  .join(", ")
50
50
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Dry
4
4
  module Effects
5
- class Instruction # rubocop:disable Lint/EmptyClass
5
+ class Instruction
6
6
  end
7
7
  end
8
8
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/class_attributes"
4
3
  require "dry/effects/frame"
5
4
 
6
5
  module Dry
@@ -65,7 +65,7 @@ module Dry
65
65
 
66
66
  def dup
67
67
  if defined? @later_calls
68
- super.tap { |p| p.instance_variable_set(:@later_calls, EMPTY_ARRAY) }
68
+ super.tap { _1.instance_variable_set(:@later_calls, EMPTY_ARRAY) }
69
69
  else
70
70
  super
71
71
  end
@@ -67,7 +67,7 @@ module Dry
67
67
  end
68
68
 
69
69
  def key?(key)
70
- values.key?(key) || key.is_a?(::String) && ::ENV.key?(key) || parent.key?(key)
70
+ values.key?(key) || (key.is_a?(::String) && ::ENV.key?(key)) || parent.key?(key)
71
71
  end
72
72
  end
73
73
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/equalizer"
4
3
  require "dry/effects/provider"
5
4
  require "dry/effects/initializer"
6
5
 
@@ -98,7 +97,7 @@ module Dry
98
97
  with_backend(backend_replace) do
99
98
  yield
100
99
  ensure
101
- owned.each { |handle| unlock(handle) }
100
+ owned.each { unlock(_1) }
102
101
  end
103
102
  end
104
103
 
@@ -35,7 +35,7 @@ module Dry
35
35
  end
36
36
 
37
37
  def provider(effect)
38
- find { |p| p.provide?(effect) }
38
+ find { _1.provide?(effect) }
39
39
  end
40
40
 
41
41
  def each(&block)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Effects
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
data/lib/dry/effects.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry/core/constants"
3
+ require "dry/core"
4
4
  require "dry/effects/version"
5
5
  require "dry/effects/container"
6
6
  require "dry/effects/errors"
@@ -62,8 +62,8 @@ module Dry
62
62
  # @param [Array<Object>] args Handler parameters
63
63
  # @return [Handler]
64
64
  # @api public
65
- def [](*args)
66
- Handler.new(*args)
65
+ def [](...)
66
+ Handler.new(...)
67
67
  end
68
68
  end
69
69
  end
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shilnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-12 00:00:00.000000000 Z
11
+ date: 2022-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -50,20 +50,20 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.5'
53
+ version: '0.9'
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '0.5'
56
+ version: '0.9'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0.5'
63
+ version: '0.9'
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: '0.5'
66
+ version: '0.9'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: dry-inflector
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -216,7 +216,7 @@ licenses:
216
216
  - MIT
217
217
  metadata:
218
218
  allowed_push_host: https://rubygems.org
219
- changelog_uri: https://github.com/dry-rb/dry-effects/blob/master/CHANGELOG.md
219
+ changelog_uri: https://github.com/dry-rb/dry-effects/blob/main/CHANGELOG.md
220
220
  source_code_uri: https://github.com/dry-rb/dry-effects
221
221
  bug_tracker_uri: https://github.com/dry-rb/dry-effects/issues
222
222
  post_install_message:
@@ -227,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
228
  - - ">="
229
229
  - !ruby/object:Gem::Version
230
- version: 2.6.0
230
+ version: 2.7.0
231
231
  required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  requirements:
233
233
  - - ">="