unity-dependency-container 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -2
- data/README.md +31 -22
- data/lib/unity/dependency_container/version.rb +1 -1
- data/lib/unity/dependency_container.rb +4 -0
- metadata +3 -4
- data/unity-dependency-container-1.0.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd4f4aa089af94042a2e8f85b178ab549fdf671811d3aeedd71eea177476f35
|
4
|
+
data.tar.gz: c38db2936eb013401b01a7903a44d1946070f90512f9eb74f473f08e974f6217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 630bcc823bf1155ccd7215386c90f9e10493228eb322c2356cc9a8f95e421288379b4eaad69db1f8e08e5ffbaf6019326647b8f344254238d31e12a90de61962
|
7
|
+
data.tar.gz: b5a67c0ec0f5fd62b225e40bfb31546b052b161f99ce1c287b0ebca0ac1d5138000e86b17fc4e0958d62e1dfab8779f63acf5e182c15d569d7d050c7c4654773
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
unity-dependency-container (1.
|
4
|
+
unity-dependency-container (1.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -9,6 +9,7 @@ GEM
|
|
9
9
|
rake (13.0.6)
|
10
10
|
|
11
11
|
PLATFORMS
|
12
|
+
arm64-darwin-21
|
12
13
|
x86_64-darwin-20
|
13
14
|
|
14
15
|
DEPENDENCIES
|
@@ -16,4 +17,4 @@ DEPENDENCIES
|
|
16
17
|
unity-dependency-container!
|
17
18
|
|
18
19
|
BUNDLED WITH
|
19
|
-
2.
|
20
|
+
2.3.3
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Unity::DependencyContainer
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple thread-safe dependency injection.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -12,24 +10,35 @@ Add this line to your application's Gemfile:
|
|
12
10
|
gem 'unity-dependency-container'
|
13
11
|
```
|
14
12
|
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install unity-dependency-container
|
22
|
-
|
23
13
|
## Usage
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
15
|
+
```ruby
|
16
|
+
class CalculatorService
|
17
|
+
def sum(a, b)
|
18
|
+
a + b
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module Foo
|
23
|
+
extend Unity::DependencyContainer
|
24
|
+
|
25
|
+
dependency 'services.calculator' do
|
26
|
+
CalculatorService.new
|
27
|
+
end
|
28
|
+
|
29
|
+
# you can also use Symbol as dependencies' names
|
30
|
+
dependency :calculator do
|
31
|
+
CalculatorService.new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
a = Foo.di('services.calculator').sum(1, 2)
|
36
|
+
b = Foo.with_dependency('services.calculator') do |dep|
|
37
|
+
dep.sum(1, 2)
|
38
|
+
end
|
39
|
+
c = Foo.with_dependency(:calculator) { |dep| dep.sum(1, 2) }
|
40
|
+
|
41
|
+
puts a # => 3
|
42
|
+
puts b # => 3
|
43
|
+
puts c # => 3
|
44
|
+
```
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unity-dependency-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saluzafa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Extend module/class abilities to provide dependencies container/injection
|
14
14
|
email:
|
@@ -27,7 +27,6 @@ files:
|
|
27
27
|
- lib/unity-dependency-container.rb
|
28
28
|
- lib/unity/dependency_container.rb
|
29
29
|
- lib/unity/dependency_container/version.rb
|
30
|
-
- unity-dependency-container-1.0.0.gem
|
31
30
|
homepage: https://github.com/pocketsizesun/unity-dependency-container
|
32
31
|
licenses: []
|
33
32
|
metadata:
|
@@ -50,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
49
|
- !ruby/object:Gem::Version
|
51
50
|
version: '0'
|
52
51
|
requirements: []
|
53
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.3.3
|
54
53
|
signing_key:
|
55
54
|
specification_version: 4
|
56
55
|
summary: Unity - Dependencies container utility
|
Binary file
|