diff options
author | Michael Herold <opensource@michaeljherold.com> | 2020-10-22 21:00:11 -0500 |
---|---|---|
committer | Michael Herold <> | 2020-10-22 21:00:11 -0500 |
commit | b9a93916f538bfab57815a1d48740c826715ca5d (patch) | |
tree | 66998d203774e19ece0adcbbe507464008fb8a60 | |
parent | ac2444c3c9d020b2d0ef1b011b5bdb37d2b4af62 (diff) | |
download | hashie-b9a93916f538bfab57815a1d48740c826715ca5d.tar.gz |
Expose `IndifferentAccess` conversion internally
In some cases --- like writing meta-extensions of `IndifferentAccess`
--- we need access to the ability to convert a key for the purposes of
`IndifferentAccess`. Exposing this behavior as a module function makes
this possible.
-rw-r--r-- | lib/hashie/extensions/indifferent_access.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/hashie/extensions/indifferent_access.rb b/lib/hashie/extensions/indifferent_access.rb index d6b9da3..2ff5f28 100644 --- a/lib/hashie/extensions/indifferent_access.rb +++ b/lib/hashie/extensions/indifferent_access.rb @@ -25,6 +25,11 @@ module Hashie module IndifferentAccess include Hashie::Extensions::RubyVersionCheck + # @api private + def self.convert_key(key) + key.to_s + end + def self.included(base) Hashie::Extensions::Dash::IndifferentAccess.maybe_extend(base) @@ -68,7 +73,7 @@ module Hashie end def convert_key(key) - key.to_s + IndifferentAccess.convert_key(key) end # Iterates through the keys and values, reconverting them to |