diff options
author | Michael Herold <opensource@michaeljherold.com> | 2019-11-17 11:16:10 -0600 |
---|---|---|
committer | Michael Herold <opensource@michaeljherold.com> | 2019-11-17 11:36:31 -0600 |
commit | 15ea67ef0667546627f9a3cd4fef4457512f5880 (patch) | |
tree | 2cf6345d16a063cd0dca51eb6a0dfc8c90ea2d80 /lib/hashie.rb | |
parent | 2846ea63a90a594ed67e3eb8ba7c5fd125909089 (diff) | |
download | hashie-15ea67ef0667546627f9a3cd4fef4457512f5880.tar.gz |
Add a PermissiveRespondTo extension for Mashes
By default, Mashes don't state that they respond to unset keys. This
causes unexpected behavior when you try to use a Mash with a
SimpleDelegator.
This new extension allows you create a permissive subclass of Mash that
will be fully compatible with SimpleDelegator and allow you to fully do
thunk-oriented programming with Mashes.
This comes with the trade-off of a ~19KB cache for each of these
subclasses and a ~20% performance penalty on any of those subclasses.
Diffstat (limited to 'lib/hashie.rb')
-rw-r--r-- | lib/hashie.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/hashie.rb b/lib/hashie.rb index a3fc11c..7f88ed4 100644 --- a/lib/hashie.rb +++ b/lib/hashie.rb @@ -45,6 +45,7 @@ module Hashie module Mash autoload :KeepOriginalKeys, 'hashie/extensions/mash/keep_original_keys' + autoload :PermissiveRespondTo, 'hashie/extensions/mash/permissive_respond_to' autoload :SafeAssignment, 'hashie/extensions/mash/safe_assignment' autoload :SymbolizeKeys, 'hashie/extensions/mash/symbolize_keys' autoload :DefineAccessors, 'hashie/extensions/mash/define_accessors' |