nxt_registry 0.3.5 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c1e56b8913dea9833ea5fac4b1b837389de5df7aa269f3b2f04977f2ddceb3
4
- data.tar.gz: 782bcb6ecce2753f77b488c29806bf1b2127714fe82aeed8ab2564297a43b95b
3
+ metadata.gz: f951682f16517cd63a1424d95c52f0db75271bebc61c7fe2cde5a72821f3381e
4
+ data.tar.gz: 1fd0496e6736a35e2a489c8791b9dfbf932fb5ba08c99d9213b908748b2a67e3
5
5
  SHA512:
6
- metadata.gz: 1e512d832f3d40ae60ffcfad8578589138c1f00479c2d2dab797c7e9faa6a37cec77da419d671715af55629e0efeac09ef5761bf39afcafe077c0d6f6af740a0
7
- data.tar.gz: 3f17bfcc73233107e2daa4db54905115aea50e6f926b8e7ed10aea6d098ff418a4f39ced0e688b02a0a207e0562f02274bdfd9f59d568734485454afe7e1f06d
6
+ metadata.gz: 30d0f4d39292e592b6622d4f670a004ba5a801730b2e21f03bad0214615076ac5bba6d40b9849f1413f22c5463336e371f79bb60f74df40d19bdcdded743b8d5
7
+ data.tar.gz: 29ba8e6fd7cae939e5e3ac171b5810153867c0a2c3da15f709d63ca536c3f90beff8c1e62cb5d29da7560152d55c73316b0e6921afe0b96ec7a06630163947ad
@@ -1,3 +1,7 @@
1
+ # v0.3.5 2020-12-23
2
+
3
+ - Allow to inherit options in nested registries
4
+
1
5
  # v0.3.5 2020-12-04
2
6
 
3
7
  - Allow patterns as keys
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_registry (0.3.5)
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.3.4)
10
+ activesupport (6.1.0)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (>= 0.7, < 2)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- zeitwerk (~> 2.2, >= 2.2.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
- thread_safe (0.3.6)
43
- tzinfo (1.2.8)
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.1.4
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
 
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext'
2
3
  require 'nxt_registry/version'
3
4
  require 'nxt_registry/blank'
@@ -39,12 +39,12 @@ module NxtRegistry
39
39
  end
40
40
 
41
41
  def registry(name, **options, &config)
42
- opts = options.merge(parent: self)
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.merge(parent: self)
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
@@ -1,3 +1,3 @@
1
1
  module NxtRegistry
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
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.5
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-04 00:00:00.000000000 Z
14
+ date: 2020-12-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport