Releases: dry-rb/dry-initializer
Releases · dry-rb/dry-initializer
Add `#using` method for shared options
Instead of
param :foo, reader: :private
option :bar, reader: :private
Use
using reader: :private do
param :foo
option :bar
end
Support for `private` and `protected` attibute readers
param :id # public reader (default)
param :name, reader: :private
param :phone, reader: :protected
param :email, reader: false # no reader
param :age, reader: public
param :gender, reader: true # public as well
Support optional params and options
class User
extend Dry::Initializer
param :name, type: Dry::Types['strict.string']
param :email, type: Dry::Types['strict.string'], default: proc { nil }
param :phone, type: Dry::Types['strict.string'], optional: true
end
user = User.new "Andrew"
user.name # => "Andrew"
user.email # => nil (default)
user.phone # => Dry::Types::UNDEFINED (new feature)
Support dry-types only as type constraints
0.4.0 Bump v0.4.0 (change types constraints)
Deprecate non-dry-types as type constraints
0.3.3 Bump v0.3.3 (deprecation warnings)
Bug fix
Support for tolerance to unknown options
Class helpers tolerant_to_unknown_options
and intolerant_to_unknown_options
allows switching on/off a regime where undeclared options are ignored without error.
Update Mixin interface for adding plugins
Use Mixin#register_initializer_plugin
for adding plugins:
mixin.register_initializer_plugin NewPlugin
instead of:
mixin.initializer_builder.register NewPlugin
Bug fix
Support plugin system
v0.2.0 Bump v0.2.0