infusible 3.5.0 → 3.7.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: bc25967c984d1fa86abba7a1319a91da40f62e2eec3a904ef93dee7e60a54dfc
4
- data.tar.gz: a086e0fd8e9ec8d644e10fbec3f30e6465666358b6f4c190010a8c3ed5105246
3
+ metadata.gz: 2ce1cb2510baeb0f069a6bff2ea8929ef09042e001f2cf24ba1147aef8089c62
4
+ data.tar.gz: 928bf12e9989a04b2517b3c30d784299a9e5ae63ca43e5a6a1ba3daae5c12a0e
5
5
  SHA512:
6
- metadata.gz: 58e0efa11b9c780f8d018c178cbb5e1f0ac1c56cc4b9b2919b3e79f4949fbc0833304c00f4284895b4f9212b62577bbbdc6f029fb5dfb2c503eb0740320c65c5
7
- data.tar.gz: f38b08ea1b7a418e1c0c3afc853e1b8fdd184a8880d7699f4320f234bb10c03f0e5e8ed59330f5f4af1ac747d0c3bdbbe01e9282bb3f7ee09aebcd36fd114288
6
+ metadata.gz: 5b096bfd86501ed206c73ab70b38ade9f9521016b14a9c19058f41344999870fd3629572c4358246c4b5e1a2cf924ea57a5591839f06ca5cc8d74ce0964a1cd2
7
+ data.tar.gz: 8437cec7b71a3a0d2b59a38d8ee16aa1478888aed4783f98fa75fbc24bc64df11b0c4e4178b7dec5c42d5329a122ecf7d2e386293f17a1aba9afc8442a752978
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- $@��F ����l ��i����ܔ3ǓڶdX��]��H�ߜ���o����4��Ǫ��^֥$J��JaX$-��:Dt���r(�;&��j�>O6��##g���M0�b[�f}��� JO� ��S�uD⹀nE����/��'I���e��k��7�*2_��9Գ�n�! ���k��Kb9��J�In;����zj���J�C)n�1h�L�~�O�- �9����i� �N:�I�UidO� #{���א�ݼ�\z�E�'�Q%CߙpMpu^�Nڶ�fo#�r<K�"LI���Y�R�r�
1
+ G�-����lx�}���Z�OG��Y_odY�‚�����A��K��ԓ6[���l�U��2{Q �/�Vy8�( ��4?NcF�Ňll1��>��vY.�L����l�b���k9ҽn��
data/README.adoc CHANGED
@@ -105,9 +105,9 @@ module Container
105
105
  end
106
106
  ----
107
107
 
108
- ==== Injectors
108
+ ==== Imports
109
109
 
110
- Once your container is defined, you'll want to define the corresponding injector for reuse within your application. Defining an injector only requires two lines of code:
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.`) _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.
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 your importer (i.e. `Import`) in as many situations as makes sense while improving performance.
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 jk depending on what was injected for that object.
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 use the refinement and define what you want stubbed in your `before` and `after` blocks. That's it!
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,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "infusible"
5
- spec.version = "3.5.0"
5
+ spec.version = "3.7.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/infusible"
9
- spec.summary = "An automated dependency manager and injector."
9
+ spec.summary = "An automatic dependency injector."
10
10
  spec.license = "Hippocratic-2.1"
11
11
 
12
12
  spec.metadata = {
@@ -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.0"
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/**/*"]
@@ -3,7 +3,7 @@
3
3
  module Infusible
4
4
  # Associates the container with the constructor for actualization.
5
5
  class Actuator
6
- def initialize container, constructor: Infusible::Constructor
6
+ def initialize container, constructor: Infusible::Builder
7
7
  @container = container
8
8
  @constructor = constructor
9
9
  end
@@ -5,7 +5,7 @@ require "marameters"
5
5
  module Infusible
6
6
  # Provides the automatic and complete resolution of all injected dependencies.
7
7
  # :reek:TooManyInstanceVariables
8
- class Constructor < Module
8
+ class Builder < Module
9
9
  def self.define_instance_variables target, keys, keywords
10
10
  unless target.instance_variable_defined? :@infused_keys
11
11
  target.instance_variable_set :@infused_names, keys
@@ -28,7 +28,9 @@ module Infusible
28
28
  @dependencies = DependencyMap.new(*configuration)
29
29
  @scope = scope
30
30
  @class_module = Class.new(Module).new
31
- @instance_module = Class.new(Module).new
31
+ @instance_module = Class.new(Module).new.set_temporary_name "infusible-parent"
32
+
33
+ freeze
32
34
  end
33
35
 
34
36
  def included descendant
data/lib/infusible.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "infusible/actuator"
4
- require "infusible/constructor"
4
+ require "infusible/builder"
5
5
  require "infusible/dependency_map"
6
6
  require "infusible/errors/duplicate_dependency"
7
7
  require "infusible/errors/invalid_dependency"
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.5.0
4
+ version: 3.7.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-03 00:00:00.000000000 Z
38
+ date: 2024-04-30 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.0'
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.0'
53
+ version: '3.3'
54
54
  description:
55
55
  email:
56
56
  - brooke@alchemists.io
@@ -65,7 +65,7 @@ files:
65
65
  - infusible.gemspec
66
66
  - lib/infusible.rb
67
67
  - lib/infusible/actuator.rb
68
- - lib/infusible/constructor.rb
68
+ - lib/infusible/builder.rb
69
69
  - lib/infusible/dependency_map.rb
70
70
  - lib/infusible/errors/duplicate_dependency.rb
71
71
  - lib/infusible/errors/invalid_dependency.rb
@@ -96,8 +96,8 @@ 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.7
99
+ rubygems_version: 3.5.9
100
100
  signing_key:
101
101
  specification_version: 4
102
- summary: An automated dependency manager and injector.
102
+ summary: An automatic dependency injector.
103
103
  test_files: []
metadata.gz.sig CHANGED
Binary file