dry-initializer 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/dry-initializer.gemspec +3 -3
- data/lib/dry/initializer/mixin.rb +0 -14
- metadata +5 -14
- data/lib/dry/initializer/scope.rb +0 -20
- data/spec/shared_definitions_spec.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4d76d7f8289370012fd8520cbfc7b2b8375b6a3
|
4
|
+
data.tar.gz: d39b5808176f0402dbeff16f18a223d179eb3a2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f1676fe465def4eb3a91f332b17115b3f0bc0968233ca092fad22279e8cc3e23e6d9d43cffbd57e2bc2978fb60971eecb3e2f5d16ebb78f3f372784c996c570
|
7
|
+
data.tar.gz: 8ea22e40b1847f4430b9fec4ab3bcce0af62e2cb864496a2c486f17b15165519b0a5b42bb043c548e557a33516e0888cb67023c0446d23b24649239b66757d64
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
## v0.
|
1
|
+
## v0.10.0 2016-11-20
|
2
|
+
|
3
|
+
### Deleted (BREAKING CHANGE!)
|
4
|
+
|
5
|
+
* Deprecated method DSL#using (@nepalez)
|
6
|
+
|
7
|
+
[Compare v0.9.3...v0.10.0](https://github.com/dry-rb/dry-initializer/compare/v0.9.3...v0.10.0)
|
8
|
+
|
9
|
+
## v0.9.3 2016-11-20
|
2
10
|
|
3
11
|
### Deprecated
|
4
12
|
|
data/dry-initializer.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "dry-initializer"
|
3
|
-
gem.version = "0.
|
3
|
+
gem.version = "0.10.0"
|
4
4
|
gem.author = ["Vladimir Kochnev (marshall-lee)", "Andrew Kozin (nepalez)"]
|
5
5
|
gem.email = ["hashtable@yandex.ru", "andrew.kozin@gmail.com"]
|
6
6
|
gem.homepage = "https://github.com/dryrb/dry-initializer"
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.required_ruby_version = ">= 2.2"
|
15
15
|
|
16
16
|
gem.add_development_dependency "rspec", "~> 3.0"
|
17
|
-
gem.add_development_dependency "rake", "
|
18
|
-
gem.add_development_dependency "dry-types", "
|
17
|
+
gem.add_development_dependency "rake", "> 10"
|
18
|
+
gem.add_development_dependency "dry-types", "> 0.5.1"
|
19
19
|
gem.add_development_dependency "rubocop", "~> 0.42"
|
20
20
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative "scope"
|
2
|
-
|
3
1
|
module Dry::Initializer
|
4
2
|
# Class-level DSL for the initializer
|
5
3
|
module Mixin
|
@@ -33,18 +31,6 @@ module Dry::Initializer
|
|
33
31
|
initializer_builder.call(self)
|
34
32
|
end
|
35
33
|
|
36
|
-
# Declares arguments (params and options) with default settings
|
37
|
-
#
|
38
|
-
# @param [Hash] settings Shared settings
|
39
|
-
# @param [Proc] block Definitions for params and options
|
40
|
-
# @return [self]
|
41
|
-
#
|
42
|
-
def using(**settings, &block)
|
43
|
-
warn "[DEPRECATION] The method `using` will be removed in v0.10.0"
|
44
|
-
Scope.new(self, settings).instance_eval(&block)
|
45
|
-
self
|
46
|
-
end
|
47
|
-
|
48
34
|
# Adds new plugin to the builder
|
49
35
|
#
|
50
36
|
# @param [Dry::Initializer::Plugins::Base] plugin
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kochnev (marshall-lee)
|
@@ -29,23 +29,20 @@ dependencies:
|
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '10
|
34
|
+
version: '10'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '10
|
41
|
+
version: '10'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: dry-types
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0.5'
|
49
46
|
- - ">"
|
50
47
|
- !ruby/object:Gem::Version
|
51
48
|
version: 0.5.1
|
@@ -53,9 +50,6 @@ dependencies:
|
|
53
50
|
prerelease: false
|
54
51
|
version_requirements: !ruby/object:Gem::Requirement
|
55
52
|
requirements:
|
56
|
-
- - "~>"
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: '0.5'
|
59
53
|
- - ">"
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: 0.5.1
|
@@ -119,7 +113,6 @@ files:
|
|
119
113
|
- lib/dry/initializer/plugins/signature.rb
|
120
114
|
- lib/dry/initializer/plugins/type_constraint.rb
|
121
115
|
- lib/dry/initializer/plugins/variable_setter.rb
|
122
|
-
- lib/dry/initializer/scope.rb
|
123
116
|
- lib/dry/initializer/signature.rb
|
124
117
|
- spec/base_spec.rb
|
125
118
|
- spec/container_spec.rb
|
@@ -133,7 +126,6 @@ files:
|
|
133
126
|
- spec/reader_spec.rb
|
134
127
|
- spec/renaming_options_spec.rb
|
135
128
|
- spec/repetitive_definitions_spec.rb
|
136
|
-
- spec/shared_definitions_spec.rb
|
137
129
|
- spec/spec_helper.rb
|
138
130
|
- spec/subclassing_spec.rb
|
139
131
|
- spec/type_argument_spec.rb
|
@@ -176,7 +168,6 @@ test_files:
|
|
176
168
|
- spec/reader_spec.rb
|
177
169
|
- spec/renaming_options_spec.rb
|
178
170
|
- spec/repetitive_definitions_spec.rb
|
179
|
-
- spec/shared_definitions_spec.rb
|
180
171
|
- spec/spec_helper.rb
|
181
172
|
- spec/subclassing_spec.rb
|
182
173
|
- spec/type_argument_spec.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Dry::Initializer
|
2
|
-
# Shared scope for several params and options
|
3
|
-
class Scope
|
4
|
-
private
|
5
|
-
|
6
|
-
def initialize(klass, **options)
|
7
|
-
@klass = klass
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
11
|
-
def method_missing(name, *args, **options)
|
12
|
-
return super unless respond_to? name
|
13
|
-
@klass.send(name, *args, **@options.merge(options))
|
14
|
-
end
|
15
|
-
|
16
|
-
def respond_to_missing?(name, *)
|
17
|
-
@klass.respond_to? name
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
describe "shared definition" do
|
2
|
-
subject do
|
3
|
-
class Test::Foo
|
4
|
-
extend Dry::Initializer::Mixin
|
5
|
-
|
6
|
-
class << self
|
7
|
-
alias_method :attribute, :param
|
8
|
-
end
|
9
|
-
|
10
|
-
using default: proc { nil } do
|
11
|
-
attribute :foo
|
12
|
-
option :end
|
13
|
-
option :baz, default: proc { 0 }
|
14
|
-
end
|
15
|
-
|
16
|
-
using optional: true do
|
17
|
-
option :qux
|
18
|
-
option :quxx, optional: false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it "is applied to params and options" do
|
24
|
-
instance = subject.new(quxx: 1)
|
25
|
-
|
26
|
-
expect(instance.foo).to be_nil
|
27
|
-
expect(instance.end).to be_nil
|
28
|
-
end
|
29
|
-
|
30
|
-
it "can be reloaded" do
|
31
|
-
instance = subject.new(quxx: 1)
|
32
|
-
|
33
|
-
expect(instance.baz).to eq 0
|
34
|
-
end
|
35
|
-
|
36
|
-
it "can reload :optional setting" do
|
37
|
-
expect { subject.new }.to raise_error(KeyError, /quxx/)
|
38
|
-
end
|
39
|
-
end
|