diff options
author | Bobby McDonald <BobbyMcWho@users.noreply.github.com> | 2019-10-14 14:14:47 -0400 |
---|---|---|
committer | Daniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org> | 2019-10-14 14:14:47 -0400 |
commit | 1a30427c9db1bdf974530aeddf90b305a3a621a5 (patch) | |
tree | 7dde72202b0fbfdd250113aa119239c322bac107 /README.md | |
parent | ca3604516b5725b30a290482c219ca55fca5de49 (diff) | |
download | hashie-1a30427c9db1bdf974530aeddf90b305a3a621a5.tar.gz |
Allow mash error silencing (#488)
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -557,6 +557,13 @@ end Response.new(merge: 'true', compact: true, zip: '90210', zap: 'electric') ``` +If you would like to create an anonymous subclass of a Hashie::Mash with key conflict warnings disabled: + +```ruby +Hashie::Mash.quiet.new(zip: '90210', compact: true) # no errors logged +Hashie::Mash.quiet(:zip).new(zip: '90210', compact: true) # error logged for compact +``` + ### How does the wrapping of Mash sub-Hashes work? Mash duplicates any sub-Hashes that you add to it and wraps them in a Mash. This allows for infinite chaining of nested Hashes within a Mash without modifying the object(s) that are passed into the Mash. When you subclass Mash, the subclass wraps any sub-Hashes in its own class. This preserves any extensions that you mixed into the Mash subclass and allows them to work within the sub-Hashes, in addition to the main containing Mash. |