trailblazer-circuit 0.0.10 → 0.0.11

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
  SHA1:
3
- metadata.gz: e4720cd4250498f880e6d24166a0abaf2bf9281e
4
- data.tar.gz: de3f4d50b0dc2ac8a68cb5d870723dce2dabc959
3
+ metadata.gz: 1a28f5ec7e9beafa955dc3e86bd72e8ed3ab707e
4
+ data.tar.gz: 4a1c4272a145d678386eeb677e003a980d569c98
5
5
  SHA512:
6
- metadata.gz: 2afcf342be6a11ffa098eb934d4b938cd4a71cce30843818d6121891b2d0189a70df99ebcf7cb7a9c287b477c6dc455ec78012007b2f0b8c9177270b05ad83eb
7
- data.tar.gz: 49f4d688f2dc7ca968904d8b949285f0f12855963bbf28c7ce3158a4b2880593ea4fb16c91ebb139cf80c801605fa0a5f779bffeb81619209f49ec8147d2fb2b
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,5 +1,5 @@
1
1
  module Trailblazer
2
2
  class Circuit
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -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(*containers)
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: dry container, etc?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-circuit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer