trailblazer-circuit 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/lib/trailblazer/circuit/version.rb +1 -1
- data/lib/trailblazer/container_chain.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a28f5ec7e9beafa955dc3e86bd72e8ed3ab707e
|
4
|
+
data.tar.gz: 4a1c4272a145d678386eeb677e003a980d569c98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f54d03327d2ea483166daf2b7469c73f67b5782003ee7dc196e05d85e80f2be3da798406b2cc1120146de8eccea1cca53623d932a8835d9114aec30d8e0fc27a
|
7
|
+
data.tar.gz: 530674e039a79d8dfae317c4672ca068b5a7c7d43e91cb6a9c364a80c5ae97185c5e9e415293dffba038dc8c950c717d063f68a22e45944c31d0234b720597c6
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 0.0.11
|
2
|
+
|
3
|
+
* Temporarily allow injecting a `to_hash` transformer into a `ContainerChain`. This allows to ignore
|
4
|
+
certain container types such as `Dry::Container` in the KW transformation. Note that this is a temp
|
5
|
+
fix and will be replaced with proper pattern matching.
|
6
|
+
|
1
7
|
# 0.0.10
|
2
8
|
|
3
9
|
* Introduce `Context::ContainerChain` to eventually replace the heavy-weight `Skill` object.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @private
|
1
2
|
class Trailblazer::Context::ContainerChain # used to be called Resolver.
|
2
3
|
# Keeps a list of containers. When looking up a key/value, containers are traversed in
|
3
4
|
# the order they were added until key is found.
|
@@ -6,8 +7,9 @@ class Trailblazer::Context::ContainerChain # used to be called Resolver.
|
|
6
7
|
#
|
7
8
|
# @note ContainerChain is an immutable data structure, it does not support writing.
|
8
9
|
# @param containers Array of <Container> objects (splatted)
|
9
|
-
def initialize(
|
10
|
+
def initialize(containers, to_hash: nil)
|
10
11
|
@containers = containers
|
12
|
+
@to_hash = to_hash
|
11
13
|
end
|
12
14
|
|
13
15
|
# @param name Symbol or String to lookup a value stored in one of the containers.
|
@@ -27,9 +29,9 @@ class Trailblazer::Context::ContainerChain # used to be called Resolver.
|
|
27
29
|
|
28
30
|
|
29
31
|
|
30
|
-
|
32
|
+
# @private
|
31
33
|
def to_hash
|
32
|
-
# FIXME:
|
34
|
+
return @to_hash.(@containers) if @to_hash # FIXME: introduce pattern matching so we can have different "transformers" for each container type.
|
33
35
|
@containers.each_with_object({}) { |container, hash| hash.merge!(container.to_hash) }
|
34
36
|
end
|
35
37
|
end
|