elastic_searchable 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/elastic_searchable.gemspec +1 -1
- data/lib/elastic_searchable/active_record.rb +7 -8
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/elastic_searchable.gemspec
CHANGED
@@ -51,24 +51,23 @@ module ElasticSearchable
|
|
51
51
|
self.run_callbacks(:after_index)
|
52
52
|
end
|
53
53
|
def should_index?
|
54
|
-
[self.class.elastic_options[:if]].flatten.compact.all? { |
|
55
|
-
![self.class.elastic_options[:unless]].flatten.compact.any? { |
|
54
|
+
[self.class.elastic_options[:if]].flatten.compact.all? { |m| evaluate_condition(m) } &&
|
55
|
+
![self.class.elastic_options[:unless]].flatten.compact.any? { |m| evaluate_condition(m) }
|
56
56
|
end
|
57
57
|
|
58
58
|
private
|
59
59
|
#ripped from activesupport
|
60
|
-
def
|
60
|
+
def evaluate_condition(method)
|
61
61
|
case method
|
62
62
|
when Symbol
|
63
|
-
|
64
|
-
object.send(method, *args, &block)
|
63
|
+
self.send method
|
65
64
|
when String
|
66
|
-
eval(method,
|
65
|
+
eval(method, self.instance_eval { binding })
|
67
66
|
when Proc, Method
|
68
|
-
method.call
|
67
|
+
method.call
|
69
68
|
else
|
70
69
|
if method.respond_to?(kind)
|
71
|
-
method.send
|
70
|
+
method.send kind
|
72
71
|
else
|
73
72
|
raise ArgumentError,
|
74
73
|
"Callbacks must be a symbol denoting the method to call, a string to be evaluated, " +
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_searchable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|