infusible 3.2.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: 6dc14ad940c37db70d202e1c536e89308476388dafb228c79c10632688ae1f80
4
- data.tar.gz: 62a63f85a1bad5e32dcf76945705d87cc2ea705c337f9f047473987992d4bfff
3
+ metadata.gz: 85febc0a6baf5496a158e328b14c18d15857f5572ea39887eab2022750e9244a
4
+ data.tar.gz: db1e0053fd1a19ea62b2de784ae98c8b3c7a1afceb916c2075bb9dd1f47df04e
5
5
  SHA512:
6
- metadata.gz: fc043d373809d1f649d32d8ed5f0e4f993511c575125f9e02843e7a81f83b5e13bcf15e7ff070866a88a9ffa2b935d1eeb5e7ec961a2f3d9b73b660c6ffce5fe
7
- data.tar.gz: 47006245798afea15ba7e440b2c71f8925cbbd649cc0fdb0785612aa7b6716d98bc11cee3bfd720be3c310307ad3a50c7b1d37bf7f3632ffa2cfe4a058176943
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.2.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.2.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-02-18 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