nxt_registry 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +10 -10
- data/README.md +17 -0
- data/lib/nxt_registry.rb +1 -0
- data/lib/nxt_registry/registry.rb +7 -2
- data/lib/nxt_registry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f951682f16517cd63a1424d95c52f0db75271bebc61c7fe2cde5a72821f3381e
|
4
|
+
data.tar.gz: 1fd0496e6736a35e2a489c8791b9dfbf932fb5ba08c99d9213b908748b2a67e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30d0f4d39292e592b6622d4f670a004ba5a801730b2e21f03bad0214615076ac5bba6d40b9849f1413f22c5463336e371f79bb60f74df40d19bdcdded743b8d5
|
7
|
+
data.tar.gz: 29ba8e6fd7cae939e5e3ac171b5810153867c0a2c3da15f709d63ca536c3f90beff8c1e62cb5d29da7560152d55c73316b0e6921afe0b96ec7a06630163947ad
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nxt_registry (0.3.
|
4
|
+
nxt_registry (0.3.6)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.0
|
10
|
+
activesupport (6.1.0)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (>=
|
13
|
-
minitest (
|
14
|
-
tzinfo (~>
|
15
|
-
zeitwerk (~> 2.
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
zeitwerk (~> 2.3)
|
16
16
|
coderay (1.1.3)
|
17
17
|
concurrent-ruby (1.1.7)
|
18
18
|
diff-lcs (1.4.4)
|
@@ -39,13 +39,13 @@ GEM
|
|
39
39
|
rspec-support (3.10.0)
|
40
40
|
rspec_junit_formatter (0.4.1)
|
41
41
|
rspec-core (>= 2, < 4, != 2.12.0)
|
42
|
-
|
43
|
-
|
44
|
-
thread_safe (~> 0.1)
|
42
|
+
tzinfo (2.0.4)
|
43
|
+
concurrent-ruby (~> 1.0)
|
45
44
|
zeitwerk (2.4.2)
|
46
45
|
|
47
46
|
PLATFORMS
|
48
47
|
ruby
|
48
|
+
x86_64-darwin-19
|
49
49
|
|
50
50
|
DEPENDENCIES
|
51
51
|
bundler (~> 2.0)
|
@@ -56,4 +56,4 @@ DEPENDENCIES
|
|
56
56
|
rspec_junit_formatter
|
57
57
|
|
58
58
|
BUNDLED WITH
|
59
|
-
2.
|
59
|
+
2.2.0
|
data/README.md
CHANGED
@@ -135,6 +135,23 @@ Nested.registry(:developers).resolve(:frontend, :igor)
|
|
135
135
|
# => 'Igor'
|
136
136
|
```
|
137
137
|
|
138
|
+
#### Inherit options in nested registries
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
class Nested
|
142
|
+
extend NxtRegistry
|
143
|
+
|
144
|
+
registry :developers, default: 'options can be inherited' do
|
145
|
+
register(:frontend, inherit_options: true) do
|
146
|
+
register(:igor, 'Igor')
|
147
|
+
register(:ben, 'Ben')
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
Nested.registry(:developers).resolve(:frontend, :blank)
|
153
|
+
# => 'options can be inherited'
|
154
|
+
```
|
138
155
|
|
139
156
|
### Defining specific nesting levels of a registry
|
140
157
|
|
data/lib/nxt_registry.rb
CHANGED
@@ -39,12 +39,12 @@ module NxtRegistry
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def registry(name, **options, &config)
|
42
|
-
opts = options
|
42
|
+
opts = conditionally_inherit_options(options)
|
43
43
|
register(name, Registry.new(name, **opts, &config))
|
44
44
|
end
|
45
45
|
|
46
46
|
def registry!(name, **options, &config)
|
47
|
-
opts = options
|
47
|
+
opts = conditionally_inherit_options(options)
|
48
48
|
register!(name, Registry.new(name, **opts, &config))
|
49
49
|
end
|
50
50
|
|
@@ -160,6 +160,11 @@ module NxtRegistry
|
|
160
160
|
attr_reader :namespace, :parent, :config, :store, :options, :accessor, :patterns
|
161
161
|
attr_accessor :is_leaf, :interface_defined
|
162
162
|
|
163
|
+
def conditionally_inherit_options(opts)
|
164
|
+
base = opts.delete(:inherit_options) ? options : {}
|
165
|
+
base.merge(opts).merge(parent: self)
|
166
|
+
end
|
167
|
+
|
163
168
|
def is_leaf?
|
164
169
|
@is_leaf
|
165
170
|
end
|
data/lib/nxt_registry/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nxt_registry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Robecke
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-12-
|
14
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|