Skip to content

Releases: dry-rb/dry-initializer

Add #options to param/option definitions

11 Sep 15:26
Compare
Choose a tag to compare
v2.1.0

Add some specs for definitions

Provide class-level container

28 Aug 18:52
Compare
Choose a tag to compare
v2.0.0

Fix .travis.yml

Isolate `#initialize` method in a separate module

05 Apr 13:36
Compare
Choose a tag to compare

Collect params along with options in @__options__ hash

02 Apr 22:14
Compare
Choose a tag to compare

Add configuration for "no-undefined" version

13 Mar 11:55
Compare
Choose a tag to compare

Make @__options__ to collect renamed opts with defaults and coercions

05 Mar 11:31
Compare
Choose a tag to compare

Support for lambdas as default values

01 Mar 17:44
Compare
Choose a tag to compare

Minor fix

04 Feb 11:52
Compare
Choose a tag to compare

Support gem enhancement

28 Jan 13:16
Compare
Choose a tag to compare
# 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

22 Jan 13:34
Compare
Choose a tag to compare
v1.0.0

Bump v1.0.0