-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix documentation for unknown arguments (#68)
Fixes the issue #68
- Loading branch information
Showing
3 changed files
with
23 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: Tolerance to Unknown Arguments | ||
layout: gem-single | ||
name: dry-initializer | ||
--- | ||
|
||
By default the initializer is tolerant for both params (positional arguments) and options. | ||
All unknown arguments of the initializer are ignored silently. | ||
|
||
```ruby | ||
require 'dry-initializer' | ||
|
||
class User | ||
extend Dry::Initializer | ||
end | ||
|
||
user = User.new 'Joe', role: 'admin' | ||
user.respond_to? :role # => false | ||
|
||
User.dry_initializer.attributes(user) | ||
# => {} | ||
``` |