dee 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +5 -0
- data/README.md +25 -1
- data/lib/dee/container.rb +1 -1
- data/lib/dee/version.rb +1 -1
- data/spec/dee/container_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf4d1e618915d470ad7ab66de4d4a163387d422
|
4
|
+
data.tar.gz: 8ca777da8c73e146d8aad7d0bb9da23daccd90c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c8eff59f13d7e59864f8ccaea3c67af280855f3eb96b57a55df7b1d1a42d85f02b3f8de3c887c2d2e5ac6b39574de610fafd2756600ca6974ed559000645a4
|
7
|
+
data.tar.gz: a6e7de81407f18a8b8319b73eb386c1bbf606055c1c47e57b938c1febc065d0c9734590f31b490f51ca68177547be16506917624cc5747fe615cf913bf0ac03c
|
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,31 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
```ruby
|
22
|
+
container = Dee::Container.new
|
23
|
+
|
24
|
+
# Define a value
|
25
|
+
container['foo.name'] = 'FOO'
|
26
|
+
|
27
|
+
# Define a factory
|
28
|
+
container.factory do 'foo'
|
29
|
+
Foo.new(self['foo.name'])
|
30
|
+
end
|
31
|
+
|
32
|
+
# Define a singleton factory
|
33
|
+
container.singleton do 'foo.singleton' do
|
34
|
+
Foo.new(self['foo.name'])
|
35
|
+
end
|
36
|
+
|
37
|
+
# Create Foo object
|
38
|
+
# This creates Foo object everytime
|
39
|
+
foo = container['foo']
|
40
|
+
|
41
|
+
# Create singleton Foo object
|
42
|
+
# This creates Foo object only at the first time
|
43
|
+
# And it returns same object after the creation
|
44
|
+
foo = container['foo.singleton']
|
45
|
+
```
|
22
46
|
|
23
47
|
## Contributing
|
24
48
|
|
data/lib/dee/container.rb
CHANGED
data/lib/dee/version.rb
CHANGED
data/spec/dee/container_spec.rb
CHANGED
@@ -3,7 +3,7 @@ describe Dee::Container do
|
|
3
3
|
|
4
4
|
describe '#[]' do
|
5
5
|
it 'raises error when no defined key is specified' do
|
6
|
-
expect { container['no_defined_key'] }.to raise_error
|
6
|
+
expect { container['no_defined_key'] }.to raise_error "'no_defined_key' is not defined in container"
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya Takeyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.2.0
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Simple DI Container/Service Locater for Ruby
|