diff options
author | Daniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org> | 2019-10-18 18:37:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-18 18:37:10 -0400 |
commit | b663703a449083a5c388f49d38c98d044c36937f (patch) | |
tree | d6782b3630b4b70ef9e66e790b022bc6d7351250 | |
parent | 20e5467188bb4b6ab4166a72c07ec2bc0b883fa0 (diff) | |
parent | a21bb32235a37d5b0c00ced22e7fbfea1734918b (diff) | |
download | hashie-b663703a449083a5c388f49d38c98d044c36937f.tar.gz |
Merge pull request #490 from BobbyMcWho/refactor-quiet
refactor quiet method
-rw-r--r-- | lib/hashie/mash.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb index 77a852f..27e6409 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -108,11 +108,10 @@ module Hashie # Hashie::Mash.quiet(:zip).new(hash) only zip warning # is disabled. def self.quiet(*method_keys) - (@memoized_classes ||= {})[method_keys] || - Class.new(self).tap do |k| - k.send(:disable_warnings, *method_keys) - @memoized_classes[method_keys] = k - end + @memoized_classes ||= {} + @memoized_classes[method_keys] ||= Class.new(self) do + disable_warnings(*method_keys) + end end class << self; alias [] new; end |