corindon 0.4.0 → 0.5.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37d5ac638b45a7b98ffa07c588b299147ae04ad8172eb9ac3d84f6b207242df7
|
4
|
+
data.tar.gz: 867092edd58ca1209d5bdfd3fd27d97f7663e63813c6266937e55b4eaa26bc8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a18f25be1501b07dab913c482f1b84308d392355182f02bc724bfc7dece28227c9aac87c7ecf6fb2bca2934019188968f9b177832303c9e7f8716254409dc0a8
|
7
|
+
data.tar.gz: ca432ab9e27df7b318052cc755d7b5f65b0b3e1bf42c6a1fae7043d27400b3108e148274ea0c862f64a5db6b3121cac3db449f9fb8cb8335aabeb4a536972151
|
@@ -21,11 +21,11 @@ module Corindon
|
|
21
21
|
|
22
22
|
# @param [Class] klass
|
23
23
|
# @return [String]
|
24
|
-
def add_definition(klass, id: nil, anonymous: false, &block)
|
24
|
+
def add_definition(klass, id: nil, anonymous: false, context: {}, &block)
|
25
25
|
definition = if injectable?(klass)
|
26
26
|
klass.definition
|
27
27
|
elsif block.sth?
|
28
|
-
Dsl.new(klass).exec(&block)
|
28
|
+
Dsl.new(klass).exec(context: context, &block)
|
29
29
|
else
|
30
30
|
Definition.new(klass)
|
31
31
|
end
|
@@ -60,6 +60,11 @@ module Corindon
|
|
60
60
|
definitions.key?(to_id(key))
|
61
61
|
end
|
62
62
|
|
63
|
+
# Clears all the cache of services
|
64
|
+
def clear
|
65
|
+
@services = {}
|
66
|
+
end
|
67
|
+
|
63
68
|
# @param [Class, #to_s] key
|
64
69
|
# @return [Object]
|
65
70
|
def get(key)
|
@@ -14,9 +14,14 @@ module Corindon
|
|
14
14
|
@anonymous = anonymous
|
15
15
|
end
|
16
16
|
|
17
|
+
# @param [Hash] context
|
17
18
|
# @return [Definition]
|
18
|
-
def exec(&block)
|
19
|
-
|
19
|
+
def exec(context: {}, &block)
|
20
|
+
if context.is_a?(Hash)
|
21
|
+
context = OpenStruct.new(context)
|
22
|
+
end
|
23
|
+
|
24
|
+
instance_exec(context, &block)
|
20
25
|
|
21
26
|
Definition.new(@klass, args: @args, kwargs: @kwargs, calls: @calls, tags: @tags, id: @id, anonymous: @anonymous)
|
22
27
|
end
|
data/lib/corindon/version.rb
CHANGED