infusible 3.3.0 → 3.4.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: 02a5684919e16bf773ea7da4a873180f2275319fd2f7a8883fd152e59914c321
4
- data.tar.gz: 458f977111e74f2b78a58a5c313a1b149d26f315ef300bf9c3a508c99cd5826d
3
+ metadata.gz: 85febc0a6baf5496a158e328b14c18d15857f5572ea39887eab2022750e9244a
4
+ data.tar.gz: db1e0053fd1a19ea62b2de784ae98c8b3c7a1afceb916c2075bb9dd1f47df04e
5
5
  SHA512:
6
- metadata.gz: 44e5c3621603e874c207aab7dbd69a48b790e8e8159551b98876cfb313194df30483e45a3b7d094d6f3aad4a2c96dc297ee2cf4136ca71c21c2d0e49c240ad73
7
- data.tar.gz: 8c35c9a2da3865a6537283d922eed96659ea82fd6ba8705a1a3f788066175f4517c7a595ead341bd305fd52fc62bc2877c3848bc462367e0f43395277f7bd01a
6
+ metadata.gz: 1772ad6440f0db0fbc6998bf4452ac4dfa3be02560309177a1f79dccf2be4649534eb64aa28860101b356b11b22fe963370dccccc7780e8634d5ef8182023d54
7
+ data.tar.gz: 6a9c9d3e65f1b3c37211bf1aa2858081f2d949334f9ca95bc43d0249d4e5b31d7ddd8964c0e12639636932e3fc21264494c612408d45ff1e938d8259599d33b5
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -326,9 +326,9 @@ demo.two # NoMethodError: protected method.
326
326
  demo.three # NoMethodError: private method.
327
327
  ----
328
328
 
329
- ==== Infused Keys
329
+ ==== Infused Names
330
330
 
331
- You have access to the keys of all infused dependencies via the _private_ `infused_keys` method which can be powerful in metaprogramming situations. For example, consider the following, which calls all injected dependencies since they have the same Object API (i.e. `#call`):
331
+ You have access to the names of all infused dependencies via the _private_ `#infused_names` method which is powerful in metaprogramming situations. For example, consider the following which calls all injected dependencies since they have the same Object API (i.e. `#call`):
332
332
 
333
333
  Example:
334
334
 
@@ -346,7 +346,7 @@ Import = Infusible.with Container
346
346
  class Demo
347
347
  include Import[:one, :two]
348
348
 
349
- def call = infused_keys.each { |key| __send__(key).call }
349
+ def call = infused_names.each { |key| __send__(key).call }
350
350
  end
351
351
 
352
352
  Demo.new.call
@@ -354,11 +354,11 @@ Demo.new.call
354
354
  # Two
355
355
  ----
356
356
 
357
- 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.
357
+ As you can see, with the _private_ `#infused_names` attribute reader, we are able to iterate through each infused name and send the `#call` message to each injected dependency.
358
358
 
359
- 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 super class in the hierarchy will have it's own unique array of infused keys depending on what was injected for that object.
359
+ Since `#infused_names` is a private attribute reader, this means the infused names 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 names depending on what was injected for that object.
360
360
 
361
- All infused keys are frozen by default.
361
+ All infused names are frozen by default.
362
362
 
363
363
  === Tests
364
364
 
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.3.0"
5
+ spec.version = "3.4.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/infusible"
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = "~> 3.3"
26
26
  spec.add_dependency "marameters", "~> 3.0"
27
- spec.add_dependency "zeitwerk", "~> 2.6"
28
27
 
29
28
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
30
29
  spec.files = Dir["*.gemspec", "lib/**/*"]
@@ -8,6 +8,7 @@ module Infusible
8
8
  class Constructor < Module
9
9
  def self.define_instance_variables target, names, keywords
10
10
  unless target.instance_variable_defined? :@infused_keys
11
+ target.instance_variable_set :@infused_names, names
11
12
  target.instance_variable_set :@infused_keys, names
12
13
  end
13
14
 
@@ -103,7 +104,14 @@ module Infusible
103
104
  computed_scope = METHOD_SCOPES.include?(scope) ? scope : :private
104
105
 
105
106
  instance_module.module_eval <<-READERS, __FILE__, __LINE__ + 1
106
- attr_reader :infused_keys
107
+ attr_reader :infused_names
108
+
109
+ def infused_keys
110
+ warn "Inusible `#infused_keys` is deprecated, use `#infused_names` instead.",
111
+ category: :deprecated
112
+ @infused_keys
113
+ end
114
+
107
115
  #{computed_scope} attr_reader #{methods.join ", "}
108
116
  READERS
109
117
  end
data/lib/infusible.rb CHANGED
@@ -1,21 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "zeitwerk"
4
-
5
- Zeitwerk::Loader.new.then do |loader|
6
- loader.tag = File.basename __FILE__, ".rb"
7
- loader.ignore "#{__dir__}/infusible/stub"
8
- loader.push_dir __dir__
9
- loader.setup
10
- end
3
+ require "infusible/actuator"
4
+ require "infusible/constructor"
5
+ require "infusible/dependency_map"
6
+ require "infusible/errors/duplicate_dependency"
7
+ require "infusible/errors/invalid_dependency"
11
8
 
12
9
  # Main namespace.
13
10
  module Infusible
14
11
  METHOD_SCOPES = %i[public protected private].freeze
15
12
 
16
- def self.loader registry = Zeitwerk::Registry
17
- @loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
18
- end
19
-
20
13
  def self.with(container) = Actuator.new container
21
14
  end
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.3.0
4
+ version: 3.4.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-03-03 00:00:00.000000000 Z
38
+ date: 2024-03-09 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: marameters
@@ -51,20 +51,6 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '3.0'
54
- - !ruby/object:Gem::Dependency
55
- name: zeitwerk
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '2.6'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '2.6'
68
54
  description:
69
55
  email:
70
56
  - brooke@alchemists.io
metadata.gz.sig CHANGED
Binary file