summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Jarema <mike@jarema.com>2016-09-09 07:29:35 -0400
committerDaniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org>2016-09-09 07:29:35 -0400
commitefea63bbd4acc8c5bd4cb466f734487b254c2b0a (patch)
tree2e4432956eeefe27b8c1f70c7a52f65bda4952e1
parentd2d645b03312a37a012514de715f4a53a9679634 (diff)
downloadhashie-efea63bbd4acc8c5bd4cb466f734487b254c2b0a.tar.gz
Checking for explicit definition of ActiveSupport::HashWithIndifferentAccess (#365)
* Checking for explicit definition of ActiveSupport::HashWithIndifferentAccess, current code assumes that the presence of ActiveSupport implies that HashWithIndifferentAccess was required * Correcting typo in CHANGELOG update * Updating CHANGELOG to log fix to #deep_locate
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/hashie/extensions/deep_locate.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab55ec5..25addd6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ scheme are considered to be bugs.
### Fixed
* [#358](https://github.com/intridea/hashie/pull/358): Fix support for Array#dig - [@modosc](https://github.com/modosc/).
+* [#365](https://github.com/intridea/hashie/pull/365): Ensure ActiveSupport::HashWithIndifferentAccess is defined before use in #deep_locate - [@mikejarema](https://github.com/mikejarema/).
### Security
diff --git a/lib/hashie/extensions/deep_locate.rb b/lib/hashie/extensions/deep_locate.rb
index feb5282..8416c3f 100644
--- a/lib/hashie/extensions/deep_locate.rb
+++ b/lib/hashie/extensions/deep_locate.rb
@@ -64,7 +64,7 @@ module Hashie
private
def self._construct_key_comparator(search_key, object)
- search_key = search_key.to_s if defined?(::ActiveSupport) && object.is_a?(::ActiveSupport::HashWithIndifferentAccess)
+ search_key = search_key.to_s if defined?(::ActiveSupport::HashWithIndifferentAccess) && object.is_a?(::ActiveSupport::HashWithIndifferentAccess)
search_key = search_key.to_s if object.respond_to?(:indifferent_access?) && object.indifferent_access?
lambda do |non_callable_object|