Releases: dry-rb/dry-initializer
Releases · dry-rb/dry-initializer
Add #options to param/option definitions
v2.1.0 Add some specs for definitions
Provide class-level container
v2.0.0 Fix .travis.yml
Isolate `#initialize` method in a separate module
v1.4.1 Bump v1.4.1
Collect params along with options in @__options__ hash
v1.4.0 Bump v1.4.0
Add configuration for "no-undefined" version
v1.3.0 Bump v1.3.0
Make @__options__ to collect renamed opts with defaults and coercions
v1.2.0 Bump v1.2.0
Support for lambdas as default values
v1.1.3 Bump v1.1.3
Minor fix
Make @__options__
var to slice default options only:
https://github.com/dry-rb/dry-initializer/blob/master/spec/options_var_spec.rb#L33-L37
Support gem enhancement
# Prepare a dispatcher for `string: true` option to be alias of `type: proc(&:to_s)`
string_dispatcher = lambda do |string: nil, **op|
string ? op.merge(type: proc(&:to_s)) : op
end
# Register the dispatcher
Dry::Initializer::Attribute.dispatchers << string_dispatcher
# Now you can use the `:string` key for `param` and `option`
class User
extend Dry::Initializer
param :name, string: true
option :city, string: true
end
user = User.new(:Andy, city: :Moscow)
user.name # => "Andy"
user.city # => "Moscow"
Stable release
v1.0.0 Bump v1.0.0