infusible 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +7 -7
- data/infusible.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f99dc573cc9c1527b47b04688ff4535369eed4669d52efa98b523fd95ff0c19
|
4
|
+
data.tar.gz: 9b1abb691f026e8277c6e5a9a9a1e095b8682879d62e5f0eff6dcff60e21bf33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e860e15f851c44d236630445e5c14ac878d4d9d603757979d6e1da5f5bfb2e6ef5f6f996db85d62cfefb9fd05fec632244ab5d6ede21f3cd541a5b5c3abd912b
|
7
|
+
data.tar.gz: 6b8718be08634a780d7b8197f2065648bed8cb01172007a3eacfba5d91261885f97126afd824ee5a72e5603ade8a985bcdcdc52d219e0f085d11616af4dd10c7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -105,9 +105,9 @@ module Container
|
|
105
105
|
end
|
106
106
|
----
|
107
107
|
|
108
|
-
====
|
108
|
+
==== Imports
|
109
109
|
|
110
|
-
Once your container is defined, you'll want to define the corresponding
|
110
|
+
Once your container is defined, you'll want to define the corresponding import for reuse within your application. Defining an import only requires two lines of code:
|
111
111
|
|
112
112
|
[source,ruby]
|
113
113
|
----
|
@@ -169,7 +169,7 @@ class Pinger
|
|
169
169
|
end
|
170
170
|
----
|
171
171
|
|
172
|
-
The namespace (i.e. `primary
|
172
|
+
The namespace (i.e. `primary`) _and_ delimiter (i.e. `.`) will be removed so only `http` and `logger` are defined for use (as shown in the `#call` method). Only dots (i.e. `.`) are allowed as the delimiter between namespace and dependency.
|
173
173
|
|
174
174
|
==== Aliases
|
175
175
|
|
@@ -217,7 +217,7 @@ class Downloader
|
|
217
217
|
end
|
218
218
|
----
|
219
219
|
|
220
|
-
This allows you to reuse
|
220
|
+
This allows you to reuse `Import` in as many situations as makes sense while improving performance.
|
221
221
|
|
222
222
|
==== Custom Initialization
|
223
223
|
|
@@ -297,7 +297,7 @@ With the above, the child class will have access to both the `logger` and `http`
|
|
297
297
|
By default -- and in all of the examples shown so far -- your dependencies are private by default when injected but you can make them public or protected. Here's a quick guide:
|
298
298
|
|
299
299
|
* `include Import[:logger]`: Injects a _private_ logger dependency.
|
300
|
-
* `include Import.protected(logger)`: Injects a _protected_ logger dependency. Useful with inheritance and a subclass needs access to the dependency.
|
300
|
+
* `include Import.protected(logger)`: Injects a _protected_ logger dependency. Useful with inheritance and a subclass that needs access to the dependency.
|
301
301
|
* `include Import.public(:logger)`: Injects a _public_ logger dependency.
|
302
302
|
|
303
303
|
There is no `+#private+` method since `#[]` does this for you and is _recommended practice_. Use of `+#public+` and `+#protected+` should be used sparingly or not at all if you can avoid it. Here's an example where public, protected, and private dependencies are injected:
|
@@ -357,7 +357,7 @@ Demo.new.call
|
|
357
357
|
|
358
358
|
As you can see, with the _private_ `#infused_keys` attribute reader, we are able to iterate through each infused key and send the `#call` message to each injected dependency.
|
359
359
|
|
360
|
-
Since `#infused_keys` is a private attribute reader, this means the infused keys are private to each instance. This includes all ancestors when using inheritance as each parent class in the hierarchy will have it's own unique array of infused
|
360
|
+
Since `#infused_keys` is a private attribute reader, this means the infused keys are private to each instance. This includes all ancestors when using inheritance as each parent class in the hierarchy will have it's own unique array of infused keys depending on what was injected for that object.
|
361
361
|
|
362
362
|
All infused keys are frozen by default.
|
363
363
|
|
@@ -407,7 +407,7 @@ RSpec.describe Action do
|
|
407
407
|
end
|
408
408
|
----
|
409
409
|
|
410
|
-
Notice there is little setup required to test the injected dependencies. You only need to
|
410
|
+
Notice there is little setup required to test the injected dependencies. You only need to stub and restore via your `before` and `after` blocks. That's it!
|
411
411
|
|
412
412
|
While the above works great for a single spec, over time you'll want to reduce duplicated setup by using a shared context. Here's a rewrite of the above spec which significantly reduces duplication when needing to test multiple objects using the same dependencies:
|
413
413
|
|
data/infusible.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "infusible"
|
5
|
-
spec.version = "3.
|
5
|
+
spec.version = "3.6.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/infusible"
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.3"
|
26
|
-
spec.add_dependency "marameters", "~> 3.
|
26
|
+
spec.add_dependency "marameters", "~> 3.3"
|
27
27
|
|
28
28
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
29
29
|
spec.files = Dir["*.gemspec", "lib/**/*"]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-04-
|
38
|
+
date: 2024-04-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: marameters
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '3.
|
46
|
+
version: '3.3'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
53
|
+
version: '3.3'
|
54
54
|
description:
|
55
55
|
email:
|
56
56
|
- brooke@alchemists.io
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.5.
|
99
|
+
rubygems_version: 3.5.9
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: An automated dependency manager and injector.
|
metadata.gz.sig
CHANGED
Binary file
|