Sha256: 2ce2ccf672074be670174d6ba9b8aac3158416711933309b3fd7fb31f723e10a
Contents?: true
Size: 841 Bytes
Versions: 2
Compression:
Stored size: 841 Bytes
Contents
--- title: Introduction & Usage description: DSL for defining initializer params and options layout: gem-single order: 8 type: gem name: dry-initializer sections: - container-version - params-and-options - options-tolerance - optionals-and-defaults - type-constraints - readers - inheritance - skip-undefined - attributes - rails-support --- `dry-initializer` is a simple mixin of class methods `params` and `options` for instances. ## Synopsis ```ruby require 'dry-initializer' class User extend Dry::Initializer param :name, proc(&:to_s) param :role, default: proc { 'customer' } option :admin, default: proc { false } option :phone, optional: true end user = User.new 'Vladimir', 'admin', admin: true user.name # => 'Vladimir' user.role # => 'admin' user.admin # => true user.phone # => nil ```
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-initializer-3.0.3 | docsite/source/index.html.md |
dry-initializer-3.0.2 | docsite/source/index.html.md |