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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f8c224268e3e35d66bade7dde3eaa5cf3423d931e0755930f5086c2151ccfc1
4
- data.tar.gz: 07275ac52d641a42609e47472c47b2f2e643e97e41a338ca4365ee2074ef8356
3
+ metadata.gz: be50d677121c471c7921e3ad842921e172fa29bef381290012a0f2a4a11980d9
4
+ data.tar.gz: 02cb06be56f166c3eacec5f29ecef2589611123467c23eccd912e44632b50f57
5
5
  SHA512:
6
- metadata.gz: 7e1275ca3ad8bec808814d88c3217ba8dd81e70a1c6de0a089560737edc2531f9aa9180fef77be430501ede727e414b9addc0cf4fd1345705923a7d729a0c6cb
7
- data.tar.gz: afb4438bb4a9e26ea815166764a12c34309c1bbe53322a948dae9851c983d74f6e5e0696715ab2a7108552e1e3436123c4bb652aad74ba1a441aba4728cd970f
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2021 dry-rb team
3
+ Copyright (c) 2015-2025 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
@@ -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 [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
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 `>= 2.7.0`
26
- * jruby `>= 9.3` (postponed until 2.7 is supported)
17
+ * MRI `>= 3.1.0`
18
+ * jruby `>= 9.4` (not tested on CI)
27
19
 
28
20
  ## License
29
21
 
@@ -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/master/CHANGELOG.md"
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 = ">= 2.7.0"
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: option,
144
- null: null,
143
+ option:,
144
+ null:,
145
145
  source: name,
146
- type: type,
147
- block: block,
146
+ type:,
147
+ block:,
148
148
  **opts
149
149
  }
150
150
 
@@ -18,11 +18,11 @@ module Dry
18
18
  def options
19
19
  {
20
20
  as: target,
21
- type: type,
22
- optional: optional,
23
- default: default,
24
- reader: reader,
25
- desc: desc
21
+ type:,
22
+ optional:,
23
+ default:,
24
+ reader:,
25
+ desc:
26
26
  }.compact
27
27
  end
28
28
 
@@ -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: parent, source: source, target: target, type: type, **options}
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
@@ -12,7 +12,7 @@ module Dry
12
12
  check_if_callable! source, type
13
13
  check_arity! source, type, wrap
14
14
 
15
- {source: source, type: type, wrap: wrap, **options}
15
+ {source:, type:, wrap:, **options}
16
16
  end
17
17
 
18
18
  private
@@ -14,7 +14,7 @@ module Dry
14
14
  default = callable! default
15
15
  check_arity! default
16
16
 
17
- {default: default, optional: (optional | default), **options}
17
+ {default:, optional: (optional | default), **options}
18
18
  end
19
19
 
20
20
  private
@@ -11,7 +11,7 @@ module Dry
11
11
  def call(target:, **options)
12
12
  ivar = "@#{target}".delete("?").to_sym
13
13
 
14
- {target: target, ivar: ivar, **options}
14
+ {target:, ivar:, **options}
15
15
  end
16
16
  end
17
17
  end
@@ -12,7 +12,7 @@ module Dry
12
12
  optional ||= default
13
13
  optional &&= !required
14
14
 
15
- {optional: !!optional, default: default, **options}
15
+ {optional: !!optional, default:, **options}
16
16
  end
17
17
  end
18
18
  end
@@ -16,7 +16,7 @@ module Dry
16
16
  else invalid_reader!(target, reader)
17
17
  end
18
18
 
19
- {target: target, reader: reader, **options}
19
+ {target:, reader:, **options}
20
20
  end
21
21
 
22
22
  private
@@ -27,7 +27,7 @@ module Dry
27
27
  check_ruby_name!(target)
28
28
  check_reserved_names!(target)
29
29
 
30
- {source: source, target: target, **options}
30
+ {source:, target:, **options}
31
31
  end
32
32
 
33
33
  private
@@ -15,7 +15,7 @@ module Dry
15
15
  def call(type: nil, wrap: 0, **options)
16
16
  type, count = unwrap(type, wrap)
17
17
 
18
- {type: type, wrap: count, **options}
18
+ {type:, wrap: count, **options}
19
19
  end
20
20
 
21
21
  private
@@ -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 nane of the variable
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: null, **options}
91
+ options = {null:, **options}
92
92
  pipeline.reduce(options) { |opts, dispatcher| dispatcher.call(**opts) }
93
93
  end
94
94
 
@@ -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: null)
29
- config.instance_exec(&(procedure || block))
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: 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
@@ -7,8 +7,8 @@ module Dry
7
7
  module Root
8
8
  private
9
9
 
10
- def initialize(...)
11
- __dry_initializer_initialize__(...)
10
+ def initialize(*args, **kwargs)
11
+ __dry_initializer_initialize__(*args, **kwargs)
12
12
  end
13
13
  end
14
14
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Initializer
5
- VERSION = "3.1.1"
5
+ VERSION = "3.2.0"
6
6
  end
7
7
  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.1.1
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: 2022-01-19 00:00:00.000000000 Z
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/master/CHANGELOG.md
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: 2.7.0
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.1.6
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: []