strudel 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9db4e6d114547cb7cea2a9fa90518d63d6bd57a740cc0e98d7e91653570c65c6
4
- data.tar.gz: 0ef732a0b969100b1e5e1d43e86437231bbdda1a77d78ad923c6bd1a96e63921
3
+ metadata.gz: f0f72dc8360ab8b2426177e2632f489493f40f11ada7d5c0d07687352b8f0d4b
4
+ data.tar.gz: df5170a8bf84b727cd13f4f25b3c73a9eba520cf789420752c2b091ff54022df
5
5
  SHA512:
6
- metadata.gz: 74888d188dd6910dc36cd8c59bd20e7600eaefad47a5084480ebfbe481112d2f773671bee37d82591df61a90835f8629c24fc5d87b17a78c16356c803ab7ee9e
7
- data.tar.gz: 34d51387b1f6784a349be15ac1aa5a30a4131c1d68d46f0aa2830997faa6e0786365fb2402ccd932252fbbeb75b4cbfbb45ee25e86b3a742d2de2730fb5ab120
6
+ metadata.gz: 32f6acfb31a208a35f17fdcc852d783cab8bc79d9d9476e66be8d8deb88faf223d2b3b494beaaae7a3ca3fb609a573a425fa4c19cccd11bd5f9f163b95194c5e
7
+ data.tar.gz: eb1501d262cab00fe9a38f25fe2df686a161cd89dc1ec978c9f2b550ae3be998bc54f71273ce6a38ab2ef0f66ba186a7b2cf7532e9593237c09ecbed9c95fbda
data/README.md CHANGED
@@ -1,19 +1,18 @@
1
1
  # Strudel
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/strudel.svg)](https://badge.fury.io/rb/strudel)
4
- [![Build Status](https://travis-ci.org/justinhoward/strudel.svg?branch=master)](https://travis-ci.org/justinhoward/strudel)
5
- [![Code Climate](https://codeclimate.com/github/justinhoward/strudel/badges/gpa.svg)](https://codeclimate.com/github/justinhoward/strudel)
6
- [![Test Coverage](https://codeclimate.com/github/justinhoward/strudel/badges/coverage.svg)](https://codeclimate.com/github/justinhoward/strudel)
7
- [![Inline docs](http://inch-ci.org/github/justinhoward/strudel.svg?branch=master)](http://inch-ci.org/github/justinhoward/strudel)
4
+ [![CI](https://github.com/justinhoward/strudel/workflows/CI/badge.svg)](https://github.com/justinhoward/strudel/actions?query=workflow%3ACI+branch%3Amaster)
5
+ [![Code Quality](https://app.codacy.com/project/badge/Grade/79b0e9d0f90c44f2baca0ea4f076ae3a)](https://www.codacy.com/gh/justinhoward/strudel/dashboard?utm_source=github.com&utm_medium=referral&utm_content=justinhoward/strudel&utm_campaign=Badge_Grade)
6
+ [![Code Coverage](https://codecov.io/github/justinhoward/strudel/graph/badge.svg?token=gDRBH8xZ8e)](https://codecov.io/github/justinhoward/strudel)
7
+ [![Online docs](https://img.shields.io/badge/docs-✓-green.svg)](https://www.rubydoc.info/github/justinhoward/strudel)
8
8
 
9
9
  Strudel is a dependency injection container for Ruby. It's a way to organize
10
- your Ruby application to take advantage of the [dependency inversion
11
- principle][ioc].
10
+ your Ruby application to take advantage of the [dependency inversion principle][ioc].
12
11
 
13
12
  ## Why another DI framework?
14
13
 
15
14
  Strudel is not a framework. It's one class that serves as a container only. No
16
- auto-injection. That means no polluting your classes with garbage injection
15
+ auto-injection. That means no polluting your classes with injection
17
16
  metaprogramming. You have full, explicit control over how your services
18
17
  are constructed.
19
18
 
@@ -26,9 +25,8 @@ dependencies in one place.
26
25
 
27
26
  You may have read [this post][dhh] by David Heineimer Hansson. However he
28
27
  didn't address the primary benefit of DI, explicitly defining dependencies.
29
- I also happen to think that patching code at runtime for testing is an egregious
30
- anti-pattern. In case you need more convincing, check out this
31
- [great post][piotr] by Piotr Solnica.
28
+ I also happen to think that patching code at runtime for testing is an
29
+ anti-pattern worth avoiding.
32
30
 
33
31
  ## Installation
34
32
 
@@ -112,7 +110,6 @@ License][mit].
112
110
 
113
111
  [ioc]: https://en.wikipedia.org/wiki/Dependency_inversion_principle
114
112
  [dhh]: http://david.heinemeierhansson.com/2012/dependency-injection-is-not-a-virtue.html
115
- [piotr]: http://solnic.eu/2013/12/17/the-world-needs-another-post-about-dependency-injection-in-ruby.html
116
113
  [papaya]: https://github.com/justinhoward/papaya
117
114
  [justin]: https://github.com/justinhoward
118
115
  [pimple]: http://pimple.sensiolabs.org
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Strudel
4
4
  # The current Strudel gem version
5
- VERSION = '1.0.2'
5
+ VERSION = '1.0.3'
6
6
 
7
7
  def self.version
8
8
  Gem::Version.new(VERSION)
data/lib/strudel.rb CHANGED
@@ -37,7 +37,7 @@ class Strudel
37
37
  #
38
38
  # If `service` is a Proc, its return value will be treated as a
39
39
  # singleton service meaning it will be initialized the first time it is
40
- # requested and its valud will be cached for subsequent requests.
40
+ # requested and its value will be cached for subsequent requests.
41
41
  #
42
42
  # Use the `set` method to allow using a block instead of a Proc argument.
43
43
  #
@@ -138,10 +138,10 @@ class Strudel
138
138
  #
139
139
  # @yield [key] Gives the key
140
140
  # @return [Enumerable, nil]
141
- def each
142
- return @services.each_key unless block_given?
141
+ def each(&block)
142
+ return @services.each_key unless block
143
143
 
144
- @services.each_key { |key| yield key }
144
+ @services.each_key(&block)
145
145
  end
146
146
 
147
147
  # Checks if a service for `key` exists.
@@ -157,7 +157,7 @@ class Strudel
157
157
  #
158
158
  # @param [key] key The service key
159
159
  # @param [value] service The service value or factory
160
- # @param [Hash] registry If the service is a proc, the registery
160
+ # @param [Hash] registry If the service is a proc, the registry
161
161
  def create(key, service, registry = nil)
162
162
  [@procs, @factories].each { |reg| reg.delete key }
163
163
  registry[key] = true if registry && service.is_a?(Proc)
metadata CHANGED
@@ -1,85 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strudel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-28 00:00:00.000000000 Z
11
+ date: 2024-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: redcarpet
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.4'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '3.4'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '3.4'
19
+ version: '3.12'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '3.4'
41
- - !ruby/object:Gem::Dependency
42
- name: rubocop
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.81.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.81.0
55
- - !ruby/object:Gem::Dependency
56
- name: simplecov
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.11'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.11'
69
- - !ruby/object:Gem::Dependency
70
- name: yard
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 0.9.11
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 0.9.11
26
+ version: '3.12'
83
27
  description:
84
28
  email:
85
29
  - jmhoward0@gmail.com
@@ -87,28 +31,19 @@ executables: []
87
31
  extensions: []
88
32
  extra_rdoc_files: []
89
33
  files:
90
- - ".gitignore"
91
- - ".rspec"
92
- - ".rubocop.yml"
93
- - ".travis.yml"
94
34
  - ".yardopts"
95
35
  - CHANGELOG.md
96
- - Gemfile
97
36
  - LICENSE.txt
98
37
  - README.md
99
- - bin/check-version
100
- - bin/rspec
101
- - bin/rubocop
102
- - bin/yard
103
- - bin/yardoc
104
- - bin/yri
105
38
  - lib/strudel.rb
106
39
  - lib/strudel/version.rb
107
- - strudel.gemspec
108
40
  homepage: https://github.com/justinhoward/strudel
109
41
  licenses:
110
42
  - MIT
111
- metadata: {}
43
+ metadata:
44
+ rubygems_mfa_required: 'true'
45
+ changelog_uri: https://github.com/justinhoward/strudel/blob/master/CHANGELOG.md
46
+ documentation_uri: https://www.rubydoc.info/gems/strudel/1.0.3
112
47
  post_install_message:
113
48
  rdoc_options: []
114
49
  require_paths:
@@ -117,14 +52,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
52
  requirements:
118
53
  - - ">="
119
54
  - !ruby/object:Gem::Version
120
- version: '0'
55
+ version: '2.3'
121
56
  required_rubygems_version: !ruby/object:Gem::Requirement
122
57
  requirements:
123
58
  - - ">="
124
59
  - !ruby/object:Gem::Version
125
60
  version: '0'
126
61
  requirements: []
127
- rubygems_version: 3.0.8
62
+ rubygems_version: 3.3.5
128
63
  signing_key:
129
64
  specification_version: 4
130
65
  summary: A tiny dependency injection container
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /coverage/
5
- /doc/
6
- /vendor/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,28 +0,0 @@
1
- ---
2
- AllCops:
3
- TargetRubyVersion: 2.3
4
-
5
- Layout/EndAlignment:
6
- EnforcedStyleAlignWith: variable
7
-
8
- Layout/ParameterAlignment:
9
- EnforcedStyle: with_fixed_indentation
10
-
11
- Layout/FirstArrayElementIndentation:
12
- EnforcedStyle: consistent
13
-
14
- Layout/FirstHashElementIndentation:
15
- EnforcedStyle: consistent
16
-
17
- Layout/MultilineMethodCallIndentation:
18
- EnforcedStyle: indented
19
-
20
- Lint/MissingCopEnableDirective:
21
- Enabled: false
22
-
23
- Metrics/BlockLength:
24
- Exclude:
25
- - spec/*
26
-
27
- Style/Documentation:
28
- Enabled: false
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- ---
2
- language: ruby
3
- rvm:
4
- - 2.3
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
- env:
10
- global:
11
- - COVERAGE=1
12
- - secure: 'O3/v5fgksUZyzVDj/I0nLOwFba9UWXjIiqXguE0gMb1t2qofeI/cEJ/2RWnUpvxuF8mbuPwJG2rU3OLK+2q2pwWpMnVbScc0G8l1mVfG6IlLdkuDWWxjtieKvAbRvcfPLaai0u4V/equs1L5izOreNhc2bp0a7+0ZMHx5SgKxg5OjglcoMIIZgSixpkqITZbPmWDFYSj812lLed1MkP6zkpUsNlxOHrAhw6e3uEPTYwCPgqr2Q08ghgxZgvJP2qbD37Ei1s/fXKmsT6nsXo6y1/mb6jnIjoPkPtykRb3sp1xfFRQMER7jJy4e6ZFCz6nIbNX+7LBzE/5xPywViZ34NrzAnNaLka15w4OxVVQM9kp6mYjZ7FwtZVY6vri40DhbrtCmWOjftRsDP42gkQB51VCMYXTYOkPaeTIJeU4kkrihc5LRDCL8ZqssdW26bLw7NJmlCgedzJV1Bzfz7VfbNi2NRp4wRB9C7vtRK4+YvqFmCu+zu8hyEcE3aqwaYBZQaERZkb6TPgifZor0Kb/uS9y31FxbYlquaLukyN298kWktktP5F+y670066OPNgAoI65Clu7PI3tE9ekUBcK1lO4b25PrVWnOz2WKGVpEhTewZ+nU3Or1oKoFTPObAdbynP080CPx1WNP+CDRphyq3yJfSb7lhw98aGKVeRVVho='
13
-
14
- before_script:
15
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
16
- - chmod +x ./cc-test-reporter
17
- - ./cc-test-reporter before-build
18
-
19
- script:
20
- - bin/rubocop
21
- - bin/rspec --format doc
22
- - bin/check-version
23
-
24
- after_script:
25
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
26
-
27
- jobs:
28
- include:
29
- - stage: release
30
- rvm: 2.3
31
- script: skip
32
- deploy:
33
- provider: rubygems
34
- api_key:
35
- secure: 'tcEf3gBUUPOVkDFjvKhBX44cYghbFLXA5BEtmBPwqDXbWaoMVSDcsBRCddLLJts2k1tmYyGVSLP7FR8zE7tfJy40iqSqQRTtdB58SxAoMdU02+x0D8uCgMwdX7qLJePoxW4WVryMo8bql7N4ydtXwlV9POJiDKK47R21G7KvIplMGvav0/SYFFfI21BzCc6Pt8X6a0EuJXJNvqFhJAEvyp+7T8M83owIXwEIsarVc3VTTmefjAJ6zAvpLlRKYU63qN1hOqdzDfGhynNAYhIgstpDwmbwSqxkn4vxmn2OQSXwCeajLiB+nDMpevPGgE9KoeKKGWmv/N0qsgLohR9HziCBl1rolhjfYKshgN18iBBOW1iKBr0sb3EeWU2EDcnDGRvCx6vqD6LTj2TkFI0/nQYuIdPK8eWogpH3hpDwQWcC970bFDWrPFnuQ/jy2wS43y+Q8eAY3cbi07qzc5dMtA/YHkl/PpXM/VjPSWz95clcKc9tSgZN6Vy9dEfYhsTbtbY32SSBw+54N9g1dBaLgeA0T5J/HfNRRldLsZmoolNpeQ11ZLD/afL0Va4rR+qgKG3Hx8Yglp34NzZhSZ0wkrw/RPE2cSCBvknwL/thw+9PKqbSiao9GGFadVJt5KajIP501Bn8oBzoHqU9OuGG8i95MNLZSktnemMbYIgBsDc='
36
- gem: strudel
37
- on:
38
- tags: true
39
- condition: bin/check-version
40
- repo: justinhoward/strudel
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in strudel.gemspec
6
- gemspec
data/bin/check-version DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- set -e
4
-
5
- tag="$(git describe --abbrev=0 2>/dev/null || echo)"
6
- tag="${tag#v}"
7
- [ "$tag" = '' ] && exit 0
8
-
9
- tag_gt_version=$(ruby -r ./lib/strudel/version -e "puts Strudel.version >= Gem::Version.new('${tag}')")
10
- test "$tag_gt_version" = true
data/bin/rspec DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
13
- '../../Gemfile',
14
- Pathname.new(__FILE__).realpath
15
- )
16
-
17
- require 'rubygems'
18
- require 'bundler/setup'
19
-
20
- load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rubocop' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
13
- '../../Gemfile',
14
- Pathname.new(__FILE__).realpath
15
- )
16
-
17
- require 'rubygems'
18
- require 'bundler/setup'
19
-
20
- load Gem.bin_path('rubocop', 'rubocop')
data/bin/yard DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yard' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
13
- '../../Gemfile',
14
- Pathname.new(__FILE__).realpath
15
- )
16
-
17
- require 'rubygems'
18
- require 'bundler/setup'
19
-
20
- load Gem.bin_path('yard', 'yard')
data/bin/yardoc DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yardoc' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
13
- '../../Gemfile',
14
- Pathname.new(__FILE__).realpath
15
- )
16
-
17
- require 'rubygems'
18
- require 'bundler/setup'
19
-
20
- load Gem.bin_path('yard', 'yardoc')
data/bin/yri DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'yri' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
13
- '../../Gemfile',
14
- Pathname.new(__FILE__).realpath
15
- )
16
-
17
- require 'rubygems'
18
- require 'bundler/setup'
19
-
20
- load Gem.bin_path('yard', 'yri')
data/strudel.gemspec DELETED
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'strudel/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'strudel'
9
- spec.version = Strudel.version
10
- spec.authors = ['Justin Howard']
11
- spec.email = ['jmhoward0@gmail.com']
12
-
13
- spec.summary = 'A tiny dependency injection container'
14
- spec.homepage = 'https://github.com/justinhoward/strudel'
15
- spec.license = 'MIT'
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(spec)/})
19
- end
20
- spec.require_paths = ['lib']
21
-
22
- spec.add_development_dependency 'redcarpet', '~> 3.4'
23
- spec.add_development_dependency 'rspec', '~> 3.4'
24
- # 0.81 is the last rubocop version with Ruby 2.3 support
25
- spec.add_development_dependency 'rubocop', '0.81.0'
26
- spec.add_development_dependency 'simplecov', '~> 0.11'
27
- spec.add_development_dependency 'yard', '>= 0.9.11'
28
- end