elastics-scopes 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/elastics/scope.rb +11 -4
- data/lib/elastics/scopes.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.9
|
data/lib/elastics/scope.rb
CHANGED
@@ -15,28 +15,35 @@ module Elastics
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def respond_to?(meth, private=false)
|
18
|
-
super || is_template?(meth) ||
|
18
|
+
super || is_template?(meth) || is_context_scope?(meth) || is_self_scope?(meth)
|
19
19
|
end
|
20
20
|
|
21
21
|
def method_missing(meth, *args, &block)
|
22
22
|
super unless respond_to?(meth)
|
23
23
|
case
|
24
|
-
when
|
24
|
+
when is_context_scope?(meth)
|
25
25
|
deep_merge self[:context].send(meth, *args, &block)
|
26
|
+
when is_self_scope?(meth)
|
27
|
+
deep_merge self[:self_context].send(meth, *args, &block)
|
26
28
|
when is_template?(meth)
|
27
29
|
self[:context].send(meth, deep_merge(*args), &block)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
|
33
|
+
private
|
32
34
|
|
33
35
|
def is_template?(name)
|
34
36
|
self[:context].respond_to?(:template_methods) && self[:context].template_methods.include?(name.to_sym)
|
35
37
|
end
|
36
38
|
|
37
|
-
def
|
39
|
+
def is_context_scope?(name)
|
38
40
|
self[:context].respond_to?(:scope_methods) && self[:context].scope_methods.include?(name.to_sym)
|
39
41
|
end
|
40
42
|
|
43
|
+
# only used for AR scopes, when you namespace the scope module
|
44
|
+
def is_self_scope?(name)
|
45
|
+
self[:self_context].respond_to?(:scope_methods) && self[:self_context].scope_methods.include?(name.to_sym)
|
46
|
+
end
|
47
|
+
|
41
48
|
end
|
42
49
|
end
|
data/lib/elastics/scopes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastics-scopes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: elastics-client
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.1.
|
21
|
+
version: 1.1.9
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.1.
|
29
|
+
version: 1.1.9
|
30
30
|
description: Provides an easy to use ruby API to search elasticsearch with ActiveRecord-like
|
31
31
|
chainable and mergeables scopes.
|
32
32
|
email: dd.nexus@gmail.com
|