Skip to content

Commit

Permalink
Expose IndifferentAccess conversion internally
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelherold committed Oct 23, 2020
1 parent 1d39b23 commit d87b733
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/hashie/extensions/indifferent_access.rb
Expand Up @@ -25,6 +25,11 @@ module Extensions
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)

Expand Down Expand Up @@ -68,7 +73,7 @@ def self.inject(hash)
end

def convert_key(key)
key.to_s
IndifferentAccess.convert_key(key)
end

# Iterates through the keys and values, reconverting them to
Expand Down

0 comments on commit d87b733

Please sign in to comment.