injectable 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +24 -24
- data/README.md +1 -1
- data/injectable.gemspec +4 -4
- data/lib/injectable/class_methods.rb +1 -1
- data/lib/injectable/dependency.rb +4 -8
- data/lib/injectable/version.rb +1 -1
- metadata +11 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec59b943de91947c9572d9bba1473f94392e5d2629b702e10dd03e98c6bb7a3a
|
4
|
+
data.tar.gz: e7e6dc95644f502e5100c3ee2f4e23c06bc40ac453e69ae1cc66bf3d6f2de329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85852a19057697f19140004c32eeadc49bc0cc9276bceccfe2b98a0d0a65ecbcf7e3a7ae8f9ac34267fdc0d10aacf34d163202ed6bc6cfa35baa05fbc52db150
|
7
|
+
data.tar.gz: db94ab469130da0d7c54dd6debb3c2ad0064b4cae0654fe2038bfb2bcb1e592efbf4c5ec0ccac2ff5bf6c8b3605f6331207b80c1d8c2b58d27c9f7662a72106e
|
data/.github/workflows/ruby.yml
CHANGED
@@ -8,15 +8,16 @@ on:
|
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
build:
|
11
|
-
|
12
11
|
runs-on: ubuntu-latest
|
13
|
-
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: [ 2.5.x, 2.6, 2.7.x ]
|
14
15
|
steps:
|
15
16
|
- uses: actions/checkout@v2
|
16
|
-
- name: Set up Ruby
|
17
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
17
18
|
uses: actions/setup-ruby@v1
|
18
19
|
with:
|
19
|
-
ruby-version:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
20
21
|
- name: Build and test with Rake
|
21
22
|
run: |
|
22
23
|
gem install bundler
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
injectable (2.
|
4
|
+
injectable (2.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
byebug (11.1.
|
10
|
-
coderay (1.1.
|
11
|
-
diff-lcs (1.
|
12
|
-
method_source (0.
|
13
|
-
pry (0.
|
14
|
-
coderay (~> 1.1
|
15
|
-
method_source (~>
|
16
|
-
pry-byebug (3.
|
9
|
+
byebug (11.1.3)
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
method_source (1.0.0)
|
13
|
+
pry (0.13.1)
|
14
|
+
coderay (~> 1.1)
|
15
|
+
method_source (~> 1.0)
|
16
|
+
pry-byebug (3.9.0)
|
17
17
|
byebug (~> 11.0)
|
18
|
-
pry (~> 0.
|
19
|
-
rake (
|
20
|
-
rspec (3.
|
21
|
-
rspec-core (~> 3.
|
22
|
-
rspec-expectations (~> 3.
|
23
|
-
rspec-mocks (~> 3.
|
24
|
-
rspec-core (3.
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-expectations (3.
|
18
|
+
pry (~> 0.13.0)
|
19
|
+
rake (13.0.3)
|
20
|
+
rspec (3.10.0)
|
21
|
+
rspec-core (~> 3.10.0)
|
22
|
+
rspec-expectations (~> 3.10.0)
|
23
|
+
rspec-mocks (~> 3.10.0)
|
24
|
+
rspec-core (3.10.1)
|
25
|
+
rspec-support (~> 3.10.0)
|
26
|
+
rspec-expectations (3.10.1)
|
27
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-mocks (3.
|
28
|
+
rspec-support (~> 3.10.0)
|
29
|
+
rspec-mocks (3.10.1)
|
30
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-support (3.
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-support (3.10.1)
|
33
33
|
|
34
34
|
PLATFORMS
|
35
35
|
ruby
|
@@ -38,8 +38,8 @@ DEPENDENCIES
|
|
38
38
|
bundler (~> 2.0)
|
39
39
|
injectable!
|
40
40
|
pry-byebug
|
41
|
-
rake (~>
|
41
|
+
rake (~> 13.0)
|
42
42
|
rspec (~> 3.0)
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
2.
|
45
|
+
2.2.4
|
data/README.md
CHANGED
@@ -355,6 +355,6 @@ Everyone interacting in the Injectable project’s codebases, issue trackers, ch
|
|
355
355
|
|
356
356
|
- [RubiconMD](https://github.com/rubiconmd) allowed extracting this gem from its codebase and release it as open source.
|
357
357
|
- [Durran Jordan](https://github.com/durran) allowed the usage of the gem name at rubygems.org.
|
358
|
-
- [David Marchante](https://github.com/
|
358
|
+
- [David Marchante](https://github.com/iovis) brainstormed the `initialize`/`call` approach, did all code reviews and provided lots of insightful feedback and suggestions. He also wrote the inline documentation.
|
359
359
|
- [Julio Antequera](https://github.com/jantequera), [Jimmi Carney](https://github.com/ayoformayo) and [Anthony Rocco](https://github.com/amrocco) had the patience to use it and report many bugs. Also most of the features in this gem came up when reviewing their usage of it. Anthony also made the effort of extracting the code from RubiconMD's codebase.
|
360
360
|
- [Rodrigo Álvarez](https://github.com/Papipo) had the idea for the DSL and actually wrote the library.
|
data/injectable.gemspec
CHANGED
@@ -5,8 +5,8 @@ require 'injectable/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'injectable'
|
7
7
|
spec.version = Injectable::VERSION
|
8
|
-
spec.authors = %w[Papipo
|
9
|
-
spec.email = %w[dev@rubiconmd.com
|
8
|
+
spec.authors = %w[Papipo iovis jantequera amrocco rewritten]
|
9
|
+
spec.email = %w[dev@rubiconmd.com]
|
10
10
|
|
11
11
|
spec.summary = 'A library to help you build nice service objects with dependency injection.'
|
12
12
|
spec.homepage = 'https://github.com/rubiconmd/injectable'
|
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.bindir = 'exe'
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
|
-
spec.required_ruby_version = '>= 2.
|
23
|
+
spec.required_ruby_version = '>= 2.5'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
26
26
|
spec.add_development_dependency 'pry-byebug'
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
29
|
end
|
@@ -97,7 +97,7 @@ module Injectable
|
|
97
97
|
options[:block] = block if block_given?
|
98
98
|
options[:depends_on] = Array(options.fetch(:depends_on, []))
|
99
99
|
options[:name] = name
|
100
|
-
dependencies.add(options)
|
100
|
+
dependencies.add(**options)
|
101
101
|
define_method name do
|
102
102
|
instance_variable_get("@#{name}") || dependencies_proxy.get(name)
|
103
103
|
end
|
@@ -20,17 +20,13 @@ module Injectable
|
|
20
20
|
raise Injectable::MethodAlreadyExistsException
|
21
21
|
end
|
22
22
|
|
23
|
-
the_instance.
|
24
|
-
call_method = call
|
25
|
-
|
26
|
-
instance.define_singleton_method(:call) do |*args, &block|
|
27
|
-
send(call_method, *args, &block)
|
28
|
-
end
|
29
|
-
end
|
23
|
+
the_instance.public_method(call)
|
30
24
|
end
|
31
25
|
|
32
26
|
def build_instance(args, namespace:)
|
33
|
-
|
27
|
+
return klass(namespace: namespace).new(*args) if block.nil?
|
28
|
+
|
29
|
+
block.call(*args)
|
34
30
|
end
|
35
31
|
|
36
32
|
def klass(namespace:)
|
data/lib/injectable/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: injectable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Papipo
|
8
|
-
-
|
8
|
+
- iovis
|
9
9
|
- jantequera
|
10
10
|
- amrocco
|
11
|
-
|
11
|
+
- rewritten
|
12
|
+
autorequire:
|
12
13
|
bindir: exe
|
13
14
|
cert_chain: []
|
14
|
-
date:
|
15
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: bundler
|
@@ -47,14 +48,14 @@ dependencies:
|
|
47
48
|
requirements:
|
48
49
|
- - "~>"
|
49
50
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
+
version: '13.0'
|
51
52
|
type: :development
|
52
53
|
prerelease: false
|
53
54
|
version_requirements: !ruby/object:Gem::Requirement
|
54
55
|
requirements:
|
55
56
|
- - "~>"
|
56
57
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
58
|
+
version: '13.0'
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
60
|
name: rspec
|
60
61
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,12 +70,9 @@ dependencies:
|
|
69
70
|
- - "~>"
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '3.0'
|
72
|
-
description:
|
73
|
+
description:
|
73
74
|
email:
|
74
75
|
- dev@rubiconmd.com
|
75
|
-
- david.marchante@rubiconmd.com
|
76
|
-
- julio@rubiconmd.com
|
77
|
-
- anthony@rubiconmd.com
|
78
76
|
executables: []
|
79
77
|
extensions: []
|
80
78
|
extra_rdoc_files: []
|
@@ -106,7 +104,7 @@ homepage: https://github.com/rubiconmd/injectable
|
|
106
104
|
licenses:
|
107
105
|
- MIT
|
108
106
|
metadata: {}
|
109
|
-
post_install_message:
|
107
|
+
post_install_message:
|
110
108
|
rdoc_options: []
|
111
109
|
require_paths:
|
112
110
|
- lib
|
@@ -114,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
112
|
requirements:
|
115
113
|
- - ">="
|
116
114
|
- !ruby/object:Gem::Version
|
117
|
-
version: '2.
|
115
|
+
version: '2.5'
|
118
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
117
|
requirements:
|
120
118
|
- - ">="
|
@@ -122,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
120
|
version: '0'
|
123
121
|
requirements: []
|
124
122
|
rubygems_version: 3.1.2
|
125
|
-
signing_key:
|
123
|
+
signing_key:
|
126
124
|
specification_version: 4
|
127
125
|
summary: A library to help you build nice service objects with dependency injection.
|
128
126
|
test_files: []
|