dry-container 0.2.2 → 0.2.3

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: 00fac333cd99a672b9cb5d60dac62f5ebcb197c1
4
- data.tar.gz: 3e040234421d7e23618d0a8fc6e5273ccdb73fb0
3
+ metadata.gz: 1e0557915422ea3394041cf54aca9b2d10f821b4
4
+ data.tar.gz: 0e42f3357d831512ddedca606657b28f0bccec7c
5
5
  SHA512:
6
- metadata.gz: f161b567597ebd6f7a102ca2815687dbd1d50b4bf6d95187e4252f4793e28ef9318cf38ffd71ffdd136721ad7b65aeadde21f392e8016c538b016236c2485618
7
- data.tar.gz: 1d6644026909c74463aa84963876d6af086ed7c6c2e8246769159298e76a8bcec1381955d2031b99fdc129e9edcc1cc05eb2784d8f5f2b0d5d4161bbc028d510
6
+ metadata.gz: 2b9c593a257dae4a0e3a756567055e5c89254a6d9c6dcc7ae2905967f97c3efa738eb6ae7d99496a3d8fff9e1555d899fdac8650af7b5cb17a63d2ab673f7b73
7
+ data.tar.gz: 218b65a59e91cd892dbd499db7b0ea46c3ce03d9d39e1d2e33ff7be1547b090c74c0f9ea635a8e09808eb6d4be0610e2eb69be7f9fb914d8930a661d7bbea41c
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  <a href="https://rubygems.org/gems/dry-container" target="_blank">![Gem Version](https://badge.fury.io/rb/dry-container.svg)</a>
4
4
  <a href="https://travis-ci.org/dryrb/dry-container" target="_blank">![Build Status](https://travis-ci.org/dryrb/dry-container.svg?branch=master)</a>
5
- <a href="http://inch-ci.org/github/dryrb/dry-container" target="_blank">![Inline docs](http://inch-ci.org/github/dryrb/dry-container.svg?branch=master&style=flat)</a>
5
+ <a href="https://gemnasium.com/dryrb/dry-container" target="_blank">![Dependency Status](https://gemnasium.com/dryrb/dry-container.svg)</a>
6
+ <a href="https://codeclimate.com/github/dryrb/dry-container" target="_blank">![Code Climate](https://codeclimate.com/github/dryrb/dry-container/badges/gpa.svg)</a>
7
+ <a href="http://inch-ci.org/github/dryrb/dry-container" target="_blank">![Documentation Status](http://inch-ci.org/github/dryrb/dry-container.svg?branch=master&style=flat)</a>
6
8
 
7
9
  A simple, configurable container implemented in Ruby
8
10
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ['lib']
17
17
 
18
18
  spec.add_runtime_dependency 'thread_safe'
19
- spec.add_runtime_dependency 'dry-configurable', '0.1.1'
19
+ spec.add_runtime_dependency 'dry-configurable', '0.1.2'
20
20
 
21
21
  spec.add_development_dependency 'bundler'
22
22
  spec.add_development_dependency 'rake'
@@ -36,8 +36,14 @@ module Dry
36
36
  setting :namespace_separator, '.'
37
37
 
38
38
  @_container = ::ThreadSafe::Cache.new
39
+
40
+ def self.inherited(subclass)
41
+ subclass.instance_variable_set(:@_container, @_container)
42
+ super
43
+ end
39
44
  end
40
45
  end
46
+
41
47
  # @private
42
48
  def self.included(base)
43
49
  base.class_eval do
@@ -59,6 +65,7 @@ module Dry
59
65
  end
60
66
  end
61
67
  end
68
+
62
69
  # Register an item with the container to be resolved later
63
70
  #
64
71
  # @param [Mixed] key
@@ -86,6 +93,7 @@ module Dry
86
93
 
87
94
  self
88
95
  end
96
+
89
97
  # Resolve an item from the container
90
98
  #
91
99
  # @param [Mixed] key
@@ -116,6 +124,7 @@ module Dry
116
124
 
117
125
  self
118
126
  end
127
+
119
128
  # Import a namespace
120
129
  #
121
130
  # @param [Dry::Container::Namespace] namespace
@@ -18,7 +18,10 @@ module Dry
18
18
  #
19
19
  # @api public
20
20
  class Namespace
21
- attr_reader :name, :block
21
+ # @return [Mixed] The namespace (name)
22
+ attr_reader :name
23
+ # @return [Proc] The block to be executed when the namespace is imported
24
+ attr_reader :block
22
25
  # Create a new namespace
23
26
  #
24
27
  # @param [Mixed] name
@@ -2,6 +2,20 @@ module Dry
2
2
  class Container
3
3
  # @api private
4
4
  class NamespaceDSL < ::SimpleDelegator
5
+ # DSL for defining namespaces
6
+ #
7
+ # @param [Dry::Container::Mixin] container
8
+ # The container
9
+ # @param [String] namespace
10
+ # The namespace (name)
11
+ # @param [String] namespace_separator
12
+ # The namespace separator
13
+ # @yield
14
+ # The block to evaluate to define the namespace
15
+ #
16
+ # @return [Mixed]
17
+ #
18
+ # @api private
5
19
  def initialize(container, namespace, namespace_separator, &block)
6
20
  @namespace = namespace
7
21
  @namespace_separator = namespace_separator
@@ -8,6 +8,7 @@ module Dry
8
8
  def initialize
9
9
  @_mutex = ::Mutex.new
10
10
  end
11
+
11
12
  # Register an item with the container to be resolved later
12
13
  #
13
14
  # @param [ThreadSafe::Hash] container
@@ -1,6 +1,6 @@
1
1
  module Dry
2
2
  class Container
3
3
  # @api public
4
- VERSION = '0.2.2'.freeze
4
+ VERSION = '0.2.3'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_safe
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
@@ -30,54 +30,54 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: 0.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.1
40
+ version: 0.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description:
@@ -87,11 +87,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
92
- - .rubocop.yml
93
- - .rubocop_todo.yml
94
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".rubocop_todo.yml"
94
+ - ".travis.yml"
95
95
  - Gemfile
96
96
  - LICENSE
97
97
  - README.md
@@ -122,17 +122,17 @@ require_paths:
122
122
  - lib
123
123
  required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - '>='
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.4.6
135
+ rubygems_version: 2.4.5.1
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: A simple container intended for use as an IoC container