README.md in dry-initializer-0.7.0 vs README.md in dry-initializer-0.8.0
- old
+ new
@@ -41,27 +41,30 @@
## Synopsis
```ruby
require 'dry-initializer'
+require 'dry-types'
class User
extend Dry::Initializer::Mixin
# Params of the initializer along with corresponding readers
- param :name
+ param :name, type: Dry::Types["strict.string"]
param :role, default: proc { 'customer' }
# Options of the initializer along with corresponding readers
option :admin, default: proc { false }
+ option :vip, optional: true
end
# Defines the initializer with params and options
user = User.new 'Vladimir', 'admin', admin: true
# Defines readers for single attributes
user.name # => 'Vladimir'
user.role # => 'admin'
user.admin # => true
+user.vip # => Dry::Initializer::UNDEFINED
```
See full documentation on the [Dry project official site][docs]
## Benchmarks