dry-initializer 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/LICENSE +1 -1
- data/README.md +4 -12
- data/dry-initializer.gemspec +2 -2
- data/lib/dry/initializer/config.rb +5 -5
- data/lib/dry/initializer/definition.rb +5 -5
- data/lib/dry/initializer/dispatchers/build_nested_type.rb +1 -2
- data/lib/dry/initializer/dispatchers/check_type.rb +1 -1
- data/lib/dry/initializer/dispatchers/prepare_default.rb +1 -1
- data/lib/dry/initializer/dispatchers/prepare_ivar.rb +1 -1
- data/lib/dry/initializer/dispatchers/prepare_optional.rb +1 -1
- data/lib/dry/initializer/dispatchers/prepare_reader.rb +1 -1
- data/lib/dry/initializer/dispatchers/prepare_target.rb +1 -1
- data/lib/dry/initializer/dispatchers/unwrap_type.rb +1 -1
- data/lib/dry/initializer/dispatchers.rb +2 -2
- data/lib/dry/initializer/dsl.rb +3 -3
- data/lib/dry/initializer/mixin/root.rb +2 -2
- data/lib/dry/initializer/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be50d677121c471c7921e3ad842921e172fa29bef381290012a0f2a4a11980d9
|
4
|
+
data.tar.gz: 02cb06be56f166c3eacec5f29ecef2589611123467c23eccd912e44632b50f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c2f86f9a06c429cd53c4452e200ac85e889ca536140fa83fbeb488e11317d1c0f4585903542d865be713cd44f86a38b1647de096994ae801afa8fed912d117
|
7
|
+
data.tar.gz: 8af84416c708e34373d30810f8e04ca4249f0ee6f2ccff6d49dd4a4477112354370c71ce5263dc5c1ff276b107617156377ae186a9ffc53a453753f154695b7b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 3.2.0 2025-01-01
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- Set minimal supported Ruby version to 3.1 (@flash-gordon)
|
9
|
+
- Exclude block forwarding from `Root#initialize`. This helps
|
10
|
+
with tracking down calls that shouldn't pass a block in Ruby 3.4 (see #109) (@flash-gordon)
|
11
|
+
|
12
|
+
|
13
|
+
[Compare v3.1.1...v3.2.0](https://github.com/dry-rb/dry-initializer/compare/v3.1.1...v3.2.0)
|
14
|
+
|
3
15
|
## 3.1.1 2022-01-19
|
4
16
|
|
5
17
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,21 @@
|
|
1
1
|
<!--- this file is synced from dry-rb/template-gem project -->
|
2
2
|
[gem]: https://rubygems.org/gems/dry-initializer
|
3
3
|
[actions]: https://github.com/dry-rb/dry-initializer/actions
|
4
|
-
[codacy]: https://www.codacy.com/gh/dry-rb/dry-initializer
|
5
|
-
[chat]: https://dry-rb.zulipchat.com
|
6
|
-
[inchpages]: http://inch-ci.org/github/dry-rb/dry-initializer
|
7
4
|
|
8
|
-
# dry-initializer [![
|
9
|
-
|
10
|
-
[![Gem Version](https://badge.fury.io/rb/dry-initializer.svg)][gem]
|
11
|
-
[![CI Status](https://github.com/dry-rb/dry-initializer/workflows/ci/badge.svg)][actions]
|
12
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/03c8923afd734e9fb0f4bfe9cc893edb)][codacy]
|
13
|
-
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/03c8923afd734e9fb0f4bfe9cc893edb)][codacy]
|
14
|
-
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-initializer.svg?branch=master)][inchpages]
|
5
|
+
# dry-initializer [![Gem Version](https://badge.fury.io/rb/dry-initializer.svg)][gem] [![CI Status](https://github.com/dry-rb/dry-initializer/workflows/ci/badge.svg)][actions]
|
15
6
|
|
16
7
|
## Links
|
17
8
|
|
18
9
|
* [User documentation](https://dry-rb.org/gems/dry-initializer)
|
19
10
|
* [API documentation](http://rubydoc.info/gems/dry-initializer)
|
11
|
+
* [Forum](https://discourse.dry-rb.org)
|
20
12
|
|
21
13
|
## Supported Ruby versions
|
22
14
|
|
23
15
|
This library officially supports the following Ruby versions:
|
24
16
|
|
25
|
-
* MRI `>=
|
26
|
-
* jruby `>= 9.
|
17
|
+
* MRI `>= 3.1.0`
|
18
|
+
* jruby `>= 9.4` (not tested on CI)
|
27
19
|
|
28
20
|
## License
|
29
21
|
|
data/dry-initializer.gemspec
CHANGED
@@ -22,11 +22,11 @@ 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-initializer/blob/
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-initializer/blob/main/CHANGELOG.md"
|
26
26
|
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-initializer"
|
27
27
|
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-initializer/issues"
|
28
28
|
|
29
|
-
spec.required_ruby_version = ">=
|
29
|
+
spec.required_ruby_version = ">= 3.1.0"
|
30
30
|
|
31
31
|
# to update dependencies edit project.yml
|
32
32
|
|
@@ -109,7 +109,7 @@ module Dry
|
|
109
109
|
def finalize
|
110
110
|
@definitions = final_definitions
|
111
111
|
check_order_of_params
|
112
|
-
mixin.class_eval(code)
|
112
|
+
mixin.class_eval(code, "#{__FILE__}:#{__LINE__} class_eval")
|
113
113
|
children.each(&:finalize)
|
114
114
|
self
|
115
115
|
end
|
@@ -140,11 +140,11 @@ module Dry
|
|
140
140
|
def add_definition(option, name, type, block, **opts)
|
141
141
|
opts = {
|
142
142
|
parent: extended_class,
|
143
|
-
option
|
144
|
-
null
|
143
|
+
option:,
|
144
|
+
null:,
|
145
145
|
source: name,
|
146
|
-
type
|
147
|
-
block
|
146
|
+
type:,
|
147
|
+
block:,
|
148
148
|
**opts
|
149
149
|
}
|
150
150
|
|
@@ -19,7 +19,7 @@ module Dry
|
|
19
19
|
check_certainty!(source, type, block)
|
20
20
|
check_name!(target, block)
|
21
21
|
type ||= build_nested_type(parent, target, block)
|
22
|
-
{parent
|
22
|
+
{parent:, source:, target:, type:, **options}
|
23
23
|
end
|
24
24
|
# rubocop: enable Metrics/ParameterLists
|
25
25
|
|
@@ -58,7 +58,6 @@ module Dry
|
|
58
58
|
|
59
59
|
def build_struct(klass_name, block)
|
60
60
|
# rubocop: disable Security/Eval
|
61
|
-
# rubocop: disable Style/DocumentDynamicEvalDefinition
|
62
61
|
eval <<~RUBY, TOPLEVEL_BINDING, __FILE__, __LINE__ + 1
|
63
62
|
class #{klass_name} < Dry::Initializer::Struct
|
64
63
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# - `:source` -- the name of source option
|
10
10
|
# - `:target` -- the target name of the reader
|
11
11
|
# - `:reader` -- if the reader's privacy (:public, :protected, :private, nil)
|
12
|
-
# - `:ivar` -- the target
|
12
|
+
# - `:ivar` -- the target name of the variable
|
13
13
|
# - `:type` -- the callable coercer of the source value
|
14
14
|
# - `:optional` -- if the argument is optional
|
15
15
|
# - `:default` -- the proc returning the default value of the source value
|
@@ -88,7 +88,7 @@ module Dry
|
|
88
88
|
# @return [Hash<Symbol, Objct>] normalized set of options
|
89
89
|
#
|
90
90
|
def call(**options)
|
91
|
-
options = {null
|
91
|
+
options = {null:, **options}
|
92
92
|
pipeline.reduce(options) { |opts, dispatcher| dispatcher.call(**opts) }
|
93
93
|
end
|
94
94
|
|
data/lib/dry/initializer/dsl.rb
CHANGED
@@ -25,8 +25,8 @@ module Dry
|
|
25
25
|
# @return [Module]
|
26
26
|
# @yield proc defining params and options
|
27
27
|
def define(procedure = nil, &block)
|
28
|
-
config = Config.new(null:
|
29
|
-
config.instance_exec(&
|
28
|
+
config = Config.new(null:)
|
29
|
+
config.instance_exec(&procedure || block)
|
30
30
|
config.mixin.include Mixin::Root
|
31
31
|
config.mixin
|
32
32
|
end
|
@@ -34,7 +34,7 @@ module Dry
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def extended(klass)
|
37
|
-
config = Config.new(klass, null:
|
37
|
+
config = Config.new(klass, null:)
|
38
38
|
klass.send :instance_variable_set, :@dry_initializer, config
|
39
39
|
klass.include Mixin::Root
|
40
40
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kochnev (marshall-lee)
|
8
8
|
- Andrew Kozin (nepalez)
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -84,10 +84,10 @@ licenses:
|
|
84
84
|
- MIT
|
85
85
|
metadata:
|
86
86
|
allowed_push_host: https://rubygems.org
|
87
|
-
changelog_uri: https://github.com/dry-rb/dry-initializer/blob/
|
87
|
+
changelog_uri: https://github.com/dry-rb/dry-initializer/blob/main/CHANGELOG.md
|
88
88
|
source_code_uri: https://github.com/dry-rb/dry-initializer
|
89
89
|
bug_tracker_uri: https://github.com/dry-rb/dry-initializer/issues
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -95,15 +95,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: 3.1.0
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
-
signing_key:
|
105
|
+
rubygems_version: 3.3.27
|
106
|
+
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: DSL for declaring params and options of the initializer
|
109
109
|
test_files: []
|