dry-plugins 0.1.0 → 0.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
  SHA1:
3
- metadata.gz: 9c3f397db9409161943cf1beb2b08991137bea56
4
- data.tar.gz: 421e745136b991141b11b2254a9d6d5a4d545ace
3
+ metadata.gz: 87c1ce9cf0a9d4ee9f93bd6b1b42f18a370e0659
4
+ data.tar.gz: 7606f33ed7c15bd0f5d466f72760ef4d286839a9
5
5
  SHA512:
6
- metadata.gz: 1aafce2b121f32b1c726cf7948dbb9517ec6830e487acdad85c96bccea58e89248a96d47795129968ac34c0d7df05acd1e4fa925eef561d4e869352f030fc387
7
- data.tar.gz: e3d80259a5e6700e7eb1009726365e319430e164b5c291237cd12e22a88ed6172b7853561298d455bc79c4ccf284119004d9f2405a9e2a2df863221b2fd21631
6
+ metadata.gz: f4c39a6968931fb5d41c74d7428b687988134fff8896368f3385604b274e616e8842134c5536bd4140529559e5c896ac6e250878ad83179fcd301a92ecb08bfd
7
+ data.tar.gz: eddbe4ae671b400a08918755fe01cc5abafb7e3b5510b566f07c2664273d781015b6c7636561f0076a605a892ae54f52a0705d600a347f3e93eeb8c37136a888
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dry-plugins (0.1.0)
4
+ dry-plugins (0.2.0)
5
5
  dry-auto_inject
6
6
  dry-configurable
7
7
  dry-container (~> 0.6.0)
@@ -35,6 +35,11 @@ module Dry
35
35
  # @return [Plugin]
36
36
  #
37
37
  # @see Dry::Plugins::Registry#resolve
38
+
39
+ # @!method plugins_registry
40
+ # @return [Registry]
41
+ #
42
+ # @see Config#registry_method
38
43
  end
39
44
  end
40
45
  end
@@ -32,7 +32,11 @@ module Dry
32
32
  # @param plugin [Module, Plugin]
33
33
  #
34
34
  # @return [Plugin]
35
- def register(key, plugin)
35
+ def register(key, plugin = nil)
36
+ if key.is_a?(Module)
37
+ plugin = key
38
+ key = Inflecto.underscore(Inflecto.demodulize(plugin.name))
39
+ end
36
40
  key = key.to_s
37
41
  plugin = plugin.plugin if plugin.is_a? Plugin
38
42
  if key?(key) && resolve(key) != plugin
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Plugins
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -25,7 +25,7 @@ module Dry
25
25
  module Plugins
26
26
  # RSpec helpers for plug-ins
27
27
  module RSpec
28
- def a_plugins_host(name: :Host, parent: nil, &block)
28
+ def an_example_class(name: :Example, parent: nil, &block)
29
29
  class_builder = Dry::Core::ClassBuilder.new(
30
30
  name: name,
31
31
  namespace: ::Object,
@@ -35,6 +35,13 @@ module Dry
35
35
  host.module_eval(&block) if block_given?
36
36
  host
37
37
  end
38
+
39
+ def a_plugins_host(name: :ExamplePluginsHost, parent: nil, &block)
40
+ an_example_class(name: name, parent: parent) do
41
+ extend Dry::Plugins
42
+ instance_exec(&block)
43
+ end
44
+ end
38
45
  end
39
46
  end
40
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Semyonov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2017-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable