Commit 44493aceb52cd37d18ad130178a8abfc66e7df89
Committed by
Andrew Kane
1 parent
e04e38ab
Exists in
master
and in
19 other branches
Adding a HashWrapper for results to prevent Hashie log warnings (#859)
Showing
3 changed files
with
14 additions
and
1 deletions
Show diff stats
lib/searchkick.rb
... | ... | @@ -6,6 +6,7 @@ require "searchkick/index_options" |
6 | 6 | require "searchkick/index" |
7 | 7 | require "searchkick/indexer" |
8 | 8 | require "searchkick/reindex_queue" |
9 | +require "searchkick/hash_wrapper" | |
9 | 10 | require "searchkick/results" |
10 | 11 | require "searchkick/query" |
11 | 12 | require "searchkick/multi_search" | ... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +module Searchkick | |
2 | + # Subclass of `Hashie::Mash` to wrap Hash-like structures | |
3 | + # (responses from Elasticsearch) | |
4 | + # | |
5 | + # The primary goal of the subclass is to disable the | |
6 | + # warning being printed by Hashie for re-defined | |
7 | + # methods, such as `sort`. | |
8 | + # | |
9 | + class HashWrapper < ::Hashie::Mash | |
10 | + disable_warnings if respond_to?(:disable_warnings) | |
11 | + end | |
12 | +end | ... | ... |