summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBobby McDonald <BobbyMcWho@users.noreply.github.com>2019-10-14 14:14:47 -0400
committerDaniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org>2019-10-14 14:14:47 -0400
commit1a30427c9db1bdf974530aeddf90b305a3a621a5 (patch)
tree7dde72202b0fbfdd250113aa119239c322bac107 /README.md
parentca3604516b5725b30a290482c219ca55fca5de49 (diff)
downloadhashie-1a30427c9db1bdf974530aeddf90b305a3a621a5.tar.gz
Allow mash error silencing (#488)
Diffstat (limited to 'README.md')
-rw-r--r--README.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0a088dd..be94965 100644
--- a/README.md
+++ b/README.md
@@ -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.