smart_container 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/smart_core/container.rb +8 -2
- data/lib/smart_core/container/definition_dsl/commands/definition/register.rb +1 -1
- data/lib/smart_core/container/registry.rb +1 -1
- data/lib/smart_core/container/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45dcb7eb69c563a3d73ba1b232b8030eb527b82c29601b62948aa37e6d54e3d6
|
4
|
+
data.tar.gz: 0f2cccd96c4a43a9912f3d97e0d7b3ca3f61492ec098b0c8337994e7eee87cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e41e917b41e5f0ae33bd321d20abffe1614ac04b19bff4e91ce9fe078e1d462cd7bb91f1fc3cae1c09aa5240e68f53bf74889df413ad03bc1f940baf8e90361d
|
7
|
+
data.tar.gz: d306a3c1076de3f4e460abf09915e0f2d4088095fd4e4d61b3f0808547f966af256673ed87a0c5ef28253c5d56e1de796d3f03fff019b66208bb535edfdb4ed4
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [0.6.0] - 2020-01-12
|
5
|
+
### Added
|
6
|
+
- Missing memoization flag `:memoize` for runtime-based dependency registration:
|
7
|
+
- `memoize: false` by default;
|
8
|
+
- signature: `SmartCore::Container#register(dependency_name, memoize: false, &dependency)`
|
9
|
+
|
4
10
|
## [0.5.0] - 2020-01-07
|
5
11
|
### Added
|
6
12
|
- Key predicates (`#key?(key)`, `#dependency?(path, memoized: nil/true/false)`, `#namespace?(path)`);
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -74,10 +74,10 @@ container.fetch('database.resolver') # => #<SomeDatabaseResolver:0x00007f0f0f1d6
|
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
container.namespace(:api) do
|
77
|
-
register(:provider) { GoogleProvider }
|
77
|
+
register(:provider) { GoogleProvider } # without memoization
|
78
78
|
end
|
79
79
|
|
80
|
-
container.register('game_api') { 'overwatch' }
|
80
|
+
container.register('game_api', memoize: true) { 'overwatch' } # with memoization
|
81
81
|
|
82
82
|
container['api.provider'] # => GoogleProvider
|
83
83
|
container['game_api'] # => 'overwatch'
|
data/lib/smart_core/container.rb
CHANGED
@@ -47,8 +47,14 @@ module SmartCore
|
|
47
47
|
#
|
48
48
|
# @api public
|
49
49
|
# @sicne 0.1.0
|
50
|
-
def register(
|
51
|
-
|
50
|
+
def register(
|
51
|
+
dependency_name,
|
52
|
+
memoize: SmartCore::Container::Registry::DEFAULT_MEMOIZATION_BEHAVIOR,
|
53
|
+
&dependency_definition
|
54
|
+
)
|
55
|
+
thread_safe do
|
56
|
+
registry.register_dependency(dependency_name, memoize: memoize, &dependency_definition)
|
57
|
+
end
|
52
58
|
end
|
53
59
|
|
54
60
|
# @param namespace_name [String, Symbol]
|
@@ -36,7 +36,7 @@ module SmartCore::Container::DefinitionDSL::Commands::Definition
|
|
36
36
|
# @since 0.1.0
|
37
37
|
# @version 0.2.0
|
38
38
|
def call(registry)
|
39
|
-
registry.register_dependency(dependency_name, memoize, &dependency_definition)
|
39
|
+
registry.register_dependency(dependency_name, memoize: memoize, &dependency_definition)
|
40
40
|
end
|
41
41
|
|
42
42
|
# @return [SmartCore::Container::DefinitionDSL::Commands::Definition::Register]
|
@@ -57,7 +57,7 @@ class SmartCore::Container::Registry
|
|
57
57
|
# @api private
|
58
58
|
# @since 0.1.0
|
59
59
|
# @version 0.3.0
|
60
|
-
def register_dependency(name, memoize
|
60
|
+
def register_dependency(name, memoize: DEFAULT_MEMOIZATION_BEHAVIOR, &dependency_definition)
|
61
61
|
thread_safe { add_dependency(name, dependency_definition, memoize) }
|
62
62
|
end
|
63
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_engine
|