Skip to content

Commit c18d0a9

Browse files
committed
[STORE] Added, that HashWrapper, a sub-class of Hashie::Mash is used
To prevent Hashie warnings, use the class introduced in 5732fa3 for wrapping Hashes, instead of Hashie::Mash directly. Related: elastic#666
1 parent dd26f59 commit c18d0a9

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

elasticsearch-persistence/lib/elasticsearch/persistence.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
require 'hashie/mash'
2+
13
require 'elasticsearch'
4+
5+
require 'elasticsearch/model/hash_wrapper'
26
require 'elasticsearch/model/indexing'
37
require 'elasticsearch/model/searching'
4-
require 'hashie'
58

69
require 'active_support/inflector'
710

elasticsearch-persistence/lib/elasticsearch/persistence/model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def deserialize(document)
113113
# Store the "hit" information (highlighting, score, ...)
114114
#
115115
object.instance_variable_set :@hit,
116-
Hashie::Mash.new(document.except('_index', '_type', '_id', '_version', '_source'))
116+
Elasticsearch::Model::HashWrapper.new(document.except('_index', '_type', '_id', '_version', '_source'))
117117

118118
object.instance_variable_set(:@persisted, true)
119119
object

elasticsearch-persistence/lib/elasticsearch/persistence/repository/response/results.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Results
1818
#
1919
def initialize(repository, response, options={})
2020
@repository = repository
21-
@response = Hashie::Mash.new(response)
21+
@response = Elasticsearch::Model::HashWrapper.new(response)
2222
@options = options
2323
end
2424

@@ -78,7 +78,7 @@ def results
7878
# results.response.aggregations.titles.buckets.map { |term| "#{term['key']}: #{term['doc_count']}" }
7979
# # => ["brown: 1", "dog: 1", ...]
8080
#
81-
# @return [Hashie::Mash]
81+
# @return [Elasticsearch::Model::HashWrapper]
8282
#
8383
def response
8484
@response

elasticsearch-persistence/test/unit/repository_response_results_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MyDocument; end
4141
assert_equal 5, subject.response['_shards']['total']
4242
end
4343

44-
should "wrap the response in Hashie::Mash" do
44+
should "wrap the response in HashWrapper" do
4545
assert_equal 5, subject.response._shards.total
4646
end
4747

0 commit comments

Comments
 (0)