elasticsearch-model 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +2 -0
- data/elasticsearch-model.gemspec +2 -0
- data/lib/elasticsearch/model.rb +4 -7
- data/lib/elasticsearch/model/version.rb +1 -1
- data/test/unit/module_test.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2Y1ZDVlOWEyODBjYzg3MmFiYjNmOTZjY2I2YTJmMjIxYzkwN2I1OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTIyNTFhZDc3MTQ3YTdiMDlmMmYwZmYxN2VjZmIyOTYyNzlhMWY1Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmE4MjU1N2UwMmYwNTJiMzM5ZjdlOWM4ZGI0NzI0NzJkYTc0YjA0OTM2M2Q5
|
10
|
+
MGUwZDBmNzFhMDg2MGQ1NTk1N2U0YmVmOWY4MTI0NGVlMzcwYjNhNjU5MzE3
|
11
|
+
OWRkYTBmNTAxZGYwOTM1MWQ5Mjc2MDU2ZTUwMDIyOTY3NTcwMmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTUzYzliYmU4NjcxYTFmYWQyMDA2MGE1ZWYwZDhhMmRiMTI3NzlkYjJhNWI3
|
14
|
+
Y2ExNzY3Mzc1NGM4MmQwZWM1MDEzZDlhMjQyYmViN2ZjNTg1NTJlZWE0NmRm
|
15
|
+
ZTA1ODRhOWQ1OTUxMWY4YjllZGE3OWQwNzFmMDM5ZDMzNmZkOTg=
|
data/CHANGELOG.md
CHANGED
data/elasticsearch-model.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.extra_rdoc_files = [ "README.md", "LICENSE.txt" ]
|
22
22
|
s.rdoc_options = [ "--charset=UTF-8" ]
|
23
23
|
|
24
|
+
s.required_ruby_version = ">= 1.9.3"
|
25
|
+
|
24
26
|
s.add_dependency "elasticsearch", '> 0.4'
|
25
27
|
s.add_dependency "activesupport", '> 3'
|
26
28
|
s.add_dependency "hashie"
|
data/lib/elasticsearch/model.rb
CHANGED
@@ -62,6 +62,7 @@ module Elasticsearch
|
|
62
62
|
# # ...
|
63
63
|
#
|
64
64
|
module Model
|
65
|
+
METHODS = [:search, :mapping, :mappings, :settings, :index_name, :document_type, :import]
|
65
66
|
|
66
67
|
# Adds the `Elasticsearch::Model` functionality to the including class.
|
67
68
|
#
|
@@ -107,13 +108,9 @@ module Elasticsearch
|
|
107
108
|
# Delegate important methods to the `__elasticsearch__` proxy, unless they are defined already
|
108
109
|
#
|
109
110
|
class << self
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
delegate :settings, to: :__elasticsearch__ unless respond_to?(:settings)
|
114
|
-
delegate :index_name, to: :__elasticsearch__ unless respond_to?(:index_name)
|
115
|
-
delegate :document_type, to: :__elasticsearch__ unless respond_to?(:document_type)
|
116
|
-
delegate :import, to: :__elasticsearch__ unless respond_to?(:import)
|
111
|
+
METHODS.each do |method|
|
112
|
+
delegate method, to: :__elasticsearch__ unless self.public_instance_methods.include?(method)
|
113
|
+
end
|
117
114
|
end
|
118
115
|
|
119
116
|
# Mix the importing module into the proxy
|
data/test/unit/module_test.rb
CHANGED
@@ -22,6 +22,11 @@ class Elasticsearch::Model::ModuleTest < Test::Unit::TestCase
|
|
22
22
|
|
23
23
|
context "when included in module/class, " do
|
24
24
|
class ::DummyIncludingModel; end
|
25
|
+
class ::DummyIncludingModelWithSearchMethodDefined
|
26
|
+
def self.search(query, options={})
|
27
|
+
"SEARCH"
|
28
|
+
end
|
29
|
+
end
|
25
30
|
|
26
31
|
should "include and set up the proxy" do
|
27
32
|
DummyIncludingModel.__send__ :include, Elasticsearch::Model
|
@@ -40,6 +45,12 @@ class Elasticsearch::Model::ModuleTest < Test::Unit::TestCase
|
|
40
45
|
assert_respond_to DummyIncludingModel, :document_type
|
41
46
|
assert_respond_to DummyIncludingModel, :import
|
42
47
|
end
|
48
|
+
|
49
|
+
should "not override existing method" do
|
50
|
+
DummyIncludingModelWithSearchMethodDefined.__send__ :include, Elasticsearch::Model
|
51
|
+
|
52
|
+
assert_equal 'SEARCH', DummyIncludingModelWithSearchMethodDefined.search('foo')
|
53
|
+
end
|
43
54
|
end
|
44
55
|
|
45
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -435,7 +435,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
435
435
|
requirements:
|
436
436
|
- - ! '>='
|
437
437
|
- !ruby/object:Gem::Version
|
438
|
-
version:
|
438
|
+
version: 1.9.3
|
439
439
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
440
440
|
requirements:
|
441
441
|
- - ! '>='
|