Releases: dry-rb/dry-initializer
Releases · dry-rb/dry-initializer
Stable release
v1.0.0 Bump v1.0.0
Support of the `initializer` reloading via `super`
v0.11.0 Bump v0.11.0
ROM integration & support of Ruby 2.4
v0.10.2 Bump v0.10.2
Bug fix
Remove deprecated method `using`
v0.10.0 Update CHANGELOG
Deprecate method `using`
Fixed validation of param/option names
v0.9.2 Bump v0.9.2
Support renaming options
class Foo
include Dry::Initializer::Mixin
option :bar, as: :foo
end
Foo.new(bar: :BAZ).foo # => :BAZ
Ever-tolerance to options
Default initializer is provided by extending the Mixin (in earlier version it was built only by param
or option
invocations.
From the very beginning the method accepts any option (ignores unknown ones)
class MyClass
extend Dry::Initializer::Mixin
end
instance = MyClass.new foo: :bar # undefined options are accepted
instance.respond_to? :foo # ...but ignored
This was made to provide more consistent behavior (in v0.8.0 tolerance to unknown options occurred all of a sudden after the first option was defined)
Support for `dry-struct`-ish syntax of type constraints
In addition to
param :name, type: Dry::Types['strict.string']
it is possible to use second argument instead of type:
option
param :name, Dry::Types['strict.string']