Skip to content

Commit 4f26d8b

Browse files
committed
Prepare 0.5.0 release
1 parent d19e1cf commit 4f26d8b

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
# 0.5.0 / 2018-11-09
2+
3+
### Changed
4+
5+
- Only assign `nil` dependency instance variables from generated `#initialize` if the instance variable has not been previously defined. This improves compatibility with objects initialized in non-conventional ways (see example below) (timriley in [#47](https://github.com/dry-rb/dry-auto_inject/pull/47))
6+
7+
```ruby
8+
module SomeFramework
9+
class Action
10+
def self.new(configuration:, **args)
11+
# Do some trickery so `#initialize` on subclasses don't need to worry
12+
# about handling a configuration kwarg and passing it to super
13+
allocate.tap do |obj|
14+
obj.instance_variable_set :@configuration, configuration
15+
obj.send :initialize, **args
16+
end
17+
end
18+
end
19+
end
20+
21+
module MyApp
22+
class Action < SomeFramework::Action
23+
# Inject the configuration object, which is passed to
24+
# SomeFramework::Action.new but not all the way through to any subsequent
25+
# `#initialize` calls
26+
include Import[configuration: "web.action.configuration"]
27+
end
28+
29+
class SomeAction < Action
30+
# Subclasses of MyApp::Action don't need to concern themselves with
31+
# `configuration` dependency
32+
include Import["some_repo"]
33+
end
34+
end
35+
```
36+
37+
[Compare v0.4.6...v0.5.0](https://github.com/dry-rb/dry-auto_inject/compare/v0.4.6...v0.5.0)
38+
139
# 0.4.6 / 2018-03-27
240

341
### Changed

lib/dry/auto_inject/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Dry
44
module AutoInject
5-
VERSION = '0.4.6'
5+
VERSION = '0.5.0'
66
end
77
end

0 commit comments

Comments
 (0)