- Add a warning about deprecation of the gem (via #89) (@solnic)
- dry-configurable will be used whenever it is in the $LOAD_PATH (see dry-rb/dry-system#247 for more context) (@solnic)
- Make
DidYouMean
integration optional (via #86) (@jbourassa)
- Accept block given to
#merge
(via #83) (@timriley)
- [BREAKING] Replace dep on dry-configurable with a simple
Configuration
mod (see #84 for more details) (@solnic) - Raise KeyError for missing key, with DidYouMean integration (via #82) (@cllns)
- Wrap FrozenError, to state that the container itself is frozen (see #74) (@cllns)
- [internal] Upgraded to new
setting
API provided in dry-configurable 0.13.0 (@timriley in #77)
- [BREAKING] Support for 2.4 and 2.5 was dropped
.resolve
accepts an optional fallback block, similar to howHash#fetch
works (flash-gordon)container.resolve('missing_key') { :fallback } # => :fallback
.decorate
can (again) work with static values. Also, it can take a block instead ofwith
(flash-gordon)container.register('key', 'value') container.decorate('key') { |v| "<'#{v}'>" } container.resolve('key') # => "<'value'>"
- Added
Mixin#dup
andMixin#clone
, now copies don't share underlying containers (flash-gordon)
-
Namespace DSL resolves keys relative to the current namespace, see the corresponding changes (yuszuv)
-
Registered objects can be decorated with the following API (igor-alexandrov)
class CreateUser def call(params) # ... end end container.register('create_user') { CreateUser.new } container.decorate('create_user', with: ShinyLogger.new) # Now subsequent resolutions will return a wrapped object container.resolve('create_user') # => #<ShinyLogger @obj=#<CreateUser:0x...>]>
-
Freezing a container now prevents further registrations (flash-gordon)
-
Handling container items was generalized in #34 (GabrielMalakias)
-
Symbols are now coerced to strings when resolving stubbed dependencies (cthulhu666)
-
Stubbing keys not present in container will raise an error (flash-gordon)
This means after upgrading you may see errors like this
ArgumentError (cannot stub "something" - no such key in container)
Be sure you register dependencies before using them. The new behavior will likely save quite a bit of time when debugging ill-configured container setups.
- [BREAKING] Now only Ruby 2.3 and above is supported (flash-gordon)
Dry::Container::Mixin#each
- provides a means of seeing what all is registered in the container (jeremyf)
- Including mixin into a class with a custom initializer (maltoe)
memoize
option to#register
- memoizes items on first resolve (ivoanjo)
required_ruby_version
set to>= 2.0.0
(artofhuman)