containable 0.3.0 → 0.5.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 +17 -2
- data/containable.gemspec +3 -3
- data/lib/containable.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +8 -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: 03b03ef9e9b2f3963c7b8dc64807da3db0a5ba339cd933aa83929f48e12fe996
|
4
|
+
data.tar.gz: 49898b80595fdeb8be50235944f64716d0cc3abd76446245553b278b9b01268e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e983cb009b3666b52a17f6a6e353d6fc3ff2af45d90f006b77f5ff5cc995c635e6c85156609ac48a171e617940fa65e7078138b0e19946cbc7815aa65e1b30bc
|
7
|
+
data.tar.gz: '054188fa73ba2ea431b4f15152ba361a3dd8e9dad24c54181d327f357506d382482ec9d629d6a291e2e17e78a147630c3376e75799b28a32685517c9f5f66337'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -93,7 +93,7 @@ end
|
|
93
93
|
# Only a module can be a container. (TypeError)
|
94
94
|
----
|
95
95
|
|
96
|
-
This is important since containers are only meant to hold your dependencies and nothing else. Modules are
|
96
|
+
This is important since containers are only meant to hold your dependencies and nothing else. Modules are perfect for this.
|
97
97
|
|
98
98
|
=== Registration
|
99
99
|
|
@@ -175,6 +175,19 @@ Container[:three] = 3
|
|
175
175
|
|
176
176
|
With the above, a combination of `.register` and `.[]=` (setter) messages are used. While the latter is handy the former should be preferred for improved readability.
|
177
177
|
|
178
|
+
⚠️ Due to registration being flexible to begin with, avoid nesting closures. Example:
|
179
|
+
|
180
|
+
[source,ruby]
|
181
|
+
----
|
182
|
+
# No
|
183
|
+
register(:sanitizer) { -> content { Sanitize.fragment content, Sanitize::Config::BASIC } }
|
184
|
+
|
185
|
+
# Yes
|
186
|
+
register :sanitizer, -> content { Sanitize.fragment content, Sanitize::Config::BASIC }
|
187
|
+
----
|
188
|
+
|
189
|
+
While the former will work, there is no benefit to nesting like this. The latter is more performant because you don't have to unwrap the nested closure to achieve the same functionality since there is nothing to achieve from the lazy resolution of the sanitize functionality.
|
190
|
+
|
178
191
|
=== Resolution
|
179
192
|
|
180
193
|
Now that you understand how to register dependencies, we can talk about resolving them. There are two ways to resolve a dependency. Example:
|
@@ -504,7 +517,7 @@ You'll notice, in all of the examples, only two methods are used: `.stub!` and `
|
|
504
517
|
|
505
518
|
_Always_ use `.stub!` to set your container up for testing. Once setup, you can add more stubs by using the `.stub` method (without the bang). So, to recap, use `.stub!` as a one-liner for setup and initial stubs then use `.stub` to add more stubs after the fact. Finally, ensure you restore (i.e. `.restore`) your container for proper cleanup after each test.
|
506
519
|
|
507
|
-
‼️ Use of `.stub!`, while convenient for testing, should -- under no
|
520
|
+
‼️ Use of `.stub!`, while convenient for testing, should -- under no circumstances -- be used in production code because it is meant for testing purposes only.
|
508
521
|
|
509
522
|
== Development
|
510
523
|
|
@@ -541,6 +554,8 @@ bin/rake
|
|
541
554
|
|
542
555
|
== link:https://alchemists.io/policies/contributions[Contributions]
|
543
556
|
|
557
|
+
== link:https://alchemists.io/policies/developer_certificate_of_origin[Developer Certificate of Origin]
|
558
|
+
|
544
559
|
== link:https://alchemists.io/projects/containable/versions[Versions]
|
545
560
|
|
546
561
|
== link:https://alchemists.io/community[Community]
|
data/containable.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "containable"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.5.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/containable"
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.metadata = {
|
13
13
|
"bug_tracker_uri" => "https://github.com/bkuhlmann/containable/issues",
|
14
14
|
"changelog_uri" => "https://alchemists.io/projects/containable/versions",
|
15
|
-
"
|
15
|
+
"homepage_uri" => "https://alchemists.io/projects/containable",
|
16
16
|
"funding_uri" => "https://github.com/sponsors/bkuhlmann",
|
17
17
|
"label" => "Containable",
|
18
18
|
"rubygems_mfa_required" => "true",
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.signing_key = Gem.default_key_path
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
|
-
spec.required_ruby_version = "
|
25
|
+
spec.required_ruby_version = ">= 3.3", "<= 3.4"
|
26
26
|
spec.add_dependency "concurrent-ruby", "~> 1.2"
|
27
27
|
|
28
28
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data/lib/containable.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: containable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.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-
|
38
|
+
date: 2024-09-01 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: concurrent-ruby
|
@@ -74,7 +74,7 @@ licenses:
|
|
74
74
|
metadata:
|
75
75
|
bug_tracker_uri: https://github.com/bkuhlmann/containable/issues
|
76
76
|
changelog_uri: https://alchemists.io/projects/containable/versions
|
77
|
-
|
77
|
+
homepage_uri: https://alchemists.io/projects/containable
|
78
78
|
funding_uri: https://github.com/sponsors/bkuhlmann
|
79
79
|
label: Containable
|
80
80
|
rubygems_mfa_required: 'true'
|
@@ -85,16 +85,19 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '3.3'
|
91
|
+
- - "<="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
91
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
95
|
requirements:
|
93
96
|
- - ">="
|
94
97
|
- !ruby/object:Gem::Version
|
95
98
|
version: '0'
|
96
99
|
requirements: []
|
97
|
-
rubygems_version: 3.5.
|
100
|
+
rubygems_version: 3.5.18
|
98
101
|
signing_key:
|
99
102
|
specification_version: 4
|
100
103
|
summary: A thread-safe dependency injection container.
|
metadata.gz.sig
CHANGED
Binary file
|